From 335b8816c2f1e66de1fa245278794f8c7fdb1e01 Mon Sep 17 00:00:00 2001 From: Ariel Flesler Date: Tue, 17 Jun 2008 20:32:15 +0000 Subject: [PATCH] jquery ajax: Fixes #3045. The protocol wasn't being checked to see if a script is required for cross domain requests. --- src/ajax.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index dbe731b..42d0b28 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; -- 1.7.10.4