diff --git a/lib/resources/script.js b/lib/resources/script.js
index db4e525d26..152476ff3e 100644
--- a/lib/resources/script.js
+++ b/lib/resources/script.js
@@ -240,7 +240,9 @@ function initSearch(name) {
}
var jsonReq = new XMLHttpRequest();
- jsonReq.open('GET', 'index.json', true);
+ var scriptUrl = URI(document.getElementById("dartdoc_script_js").src);
+
+ jsonReq.open('GET', URI(scriptUrl.directory() + '/..').absoluteTo(scriptUrl) + '/index.json', true);
jsonReq.addEventListener('load', function() {
searchIndex = JSON.parse(jsonReq.responseText);
initTypeahead();
diff --git a/lib/templates/_footer.html b/lib/templates/_footer.html
index bac8322bab..afcc2cc97a 100644
--- a/lib/templates/_footer.html
+++ b/lib/templates/_footer.html
@@ -16,7 +16,7 @@
-
+