summaryrefslogtreecommitdiff
path: root/src/runtime/javascript/minibar/support.js
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-03-01 14:47:20 +0000
committerhallgren <hallgren@chalmers.se>2011-03-01 14:47:20 +0000
commit45b59b0e7ed1e06d25f8a69a0a33669aa8625b49 (patch)
treef56f839eb50cdf024771e4b8d456c35d63d8faab /src/runtime/javascript/minibar/support.js
parenta01704fd3e801767369c92435ecdf1e59c7d401a (diff)
minibar/support.js: recognize relative URLs as locations on the same server
This means that the relative grammar directory location in the default configuration will result in AJAX requests rather than the less efficient JSONP requests.
Diffstat (limited to 'src/runtime/javascript/minibar/support.js')
-rw-r--r--src/runtime/javascript/minibar/support.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/javascript/minibar/support.js b/src/runtime/javascript/minibar/support.js
index 03757173d..f6c7d7dc6 100644
--- a/src/runtime/javascript/minibar/support.js
+++ b/src/runtime/javascript/minibar/support.js
@@ -90,7 +90,9 @@ function ajax_http_get_json(url,cont) {
}
function sameOrigin(url) {
- return hasPrefix(url,location.protocol+"//"+location.host+"/");
+ var a=empty("a");
+ a.href=url; // converts to an absolute URL
+ return hasPrefix(a.href,location.protocol+"//"+location.host+"/");
}
// Use AJAX when possible, fallback to JSONP