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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user