diff options
author | Ariel Flesler <aflesler@gmail.com> | 2008-05-13 19:47:39 +0000 |
---|---|---|
committer | Ariel Flesler <aflesler@gmail.com> | 2008-05-13 19:47:39 +0000 |
commit | 5c0aea3bfe58142c0f92fc3a059588455376ec29 (patch) | |
tree | be69d157bbacaa05ea901249f034df63d082531e /src/ajax.js | |
parent | bf802496c6b1055222814e8cd5185c023eadf202 (diff) | |
download | jquery-5c0aea3bfe58142c0f92fc3a059588455376ec29.tar.gz jquery-5c0aea3bfe58142c0f92fc3a059588455376ec29.zip |
jquery ajax: absolute urls were assumed to be cross domain. Closes #2816.
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ajax.js b/src/ajax.js index 244397f4c..598232f68 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -235,7 +235,8 @@ jQuery.extend({ // If we're requesting a remote document // and trying to load JSON or Script with a GET - if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && s.dataType == "script" && s.type.toLowerCase() == "get" ) { + if ( s.dataType == "script" && s.type.toLowerCase() == "get" + && jQuery.ajax.re.test(s.url) && jQuery.ajax.re.exec(s.url)[1] != location.host ){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = s.url; @@ -499,3 +500,6 @@ jQuery.extend({ } }); + +// Matches an absolute URL, and saves the domain +jQuery.ajax.re = /^(?:\w+:)?\/\/([^\/?#]+)/; |