diff options
| author | hallgren <hallgren@chalmers.se> | 2011-03-01 14:47:20 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2011-03-01 14:47:20 +0000 |
| commit | 45b59b0e7ed1e06d25f8a69a0a33669aa8625b49 (patch) | |
| tree | f56f839eb50cdf024771e4b8d456c35d63d8faab /src | |
| parent | a01704fd3e801767369c92435ecdf1e59c7d401a (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')
| -rw-r--r-- | src/runtime/javascript/minibar/support.js | 4 |
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 |
