aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax.js
diff options
context:
space:
mode:
authorAriel Flesler <aflesler@gmail.com>2008-06-17 20:32:15 +0000
committerAriel Flesler <aflesler@gmail.com>2008-06-17 20:32:15 +0000
commit335b8816c2f1e66de1fa245278794f8c7fdb1e01 (patch)
treeb84c212b72e3f93cb90719b85439ac5be4105928 /src/ajax.js
parentfebe463cc29ab68270ad70aa9c0314373cfd1c95 (diff)
downloadjquery-335b8816c2f1e66de1fa245278794f8c7fdb1e01.tar.gz
jquery-335b8816c2f1e66de1fa245278794f8c7fdb1e01.zip
jquery ajax: Fixes #3045. The protocol wasn't being checked to see if a script is required for cross domain requests.
Diffstat (limited to 'src/ajax.js')
-rw-r--r--src/ajax.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ajax.js b/src/ajax.js
index dbe731b29..42d0b280c 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -236,12 +236,13 @@ jQuery.extend({
jQuery.event.trigger( "ajaxStart" );
// Matches an absolute URL, and saves the domain
- var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
+ var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
- if ( s.dataType == "script" && type == "GET"
- && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
+ if ( s.dataType == "script" && type == "GET" && parts
+ && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
+
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;