Commit 335b8816 authored by Ariel Flesler's avatar Ariel Flesler

jquery ajax: Fixes #3045. The protocol wasn't being checked to see if a script...

jquery ajax: Fixes #3045. The protocol wasn't being checked to see if a script is required for cross domain requests.
parent febe463c
...@@ -236,12 +236,13 @@ jQuery.extend({ ...@@ -236,12 +236,13 @@ jQuery.extend({
jQuery.event.trigger( "ajaxStart" ); jQuery.event.trigger( "ajaxStart" );
// Matches an absolute URL, and saves the domain // Matches an absolute URL, and saves the domain
var remote = /^(?:\w+:)?\/\/([^\/?#]+)/; var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
// If we're requesting a remote document // If we're requesting a remote document
// and trying to load JSON or Script with a GET // and trying to load JSON or Script with a GET
if ( s.dataType == "script" && type == "GET" if ( s.dataType == "script" && type == "GET" && parts
&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ){ && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
var head = document.getElementsByTagName("head")[0]; var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script"); var script = document.createElement("script");
script.src = s.url; script.src = s.url;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment