1
0
forked from GitHub/gf-core

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.
This commit is contained in:
hallgren
2011-03-01 14:47:20 +00:00
parent a27f58d6ae
commit da740b51c2

View File

@@ -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