File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -275,13 +275,12 @@ jQuery.extend({
275275 }
276276
277277 // Matches an absolute URL, and saves the domain
278- var parts = rurl . exec ( s . url ) ;
278+ var parts = rurl . exec ( s . url ) ,
279+ remote = parts && ( parts [ 1 ] && parts [ 1 ] !== location . protocol || parts [ 2 ] !== location . host ) ;
279280
280281 // If we're requesting a remote document
281282 // and trying to load JSON or Script with a GET
282- if ( s . dataType === "script" && type === "GET" && parts
283- && ( parts [ 1 ] && parts [ 1 ] !== location . protocol || parts [ 2 ] !== location . host ) ) {
284-
283+ if ( s . dataType === "script" && type === "GET" && remote ) {
285284 var head = document . getElementsByTagName ( "head" ) [ 0 ] || document . documentElement ;
286285 var script = document . createElement ( "script" ) ;
287286 script . src = s . url ;
@@ -350,7 +349,10 @@ jQuery.extend({
350349 }
351350
352351 // Set header so the called script knows that it's an XMLHttpRequest
353- xhr . setRequestHeader ( "X-Requested-With" , "XMLHttpRequest" ) ;
352+ // Only send the header if it's not a remote XHR
353+ if ( ! remote ) {
354+ xhr . setRequestHeader ( "X-Requested-With" , "XMLHttpRequest" ) ;
355+ }
354356
355357 // Set the Accepts header for the server, depending on the dataType
356358 xhr . setRequestHeader ( "Accept" , s . dataType && s . accepts [ s . dataType ] ?
You can’t perform that action at this time.
0 commit comments