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({
275
275
}
276
276
277
277
// 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 ) ;
279
280
280
281
// If we're requesting a remote document
281
282
// 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 ) {
285
284
var head = document . getElementsByTagName ( "head" ) [ 0 ] || document . documentElement ;
286
285
var script = document . createElement ( "script" ) ;
287
286
script . src = s . url ;
@@ -350,7 +349,10 @@ jQuery.extend({
350
349
}
351
350
352
351
// 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
+ }
354
356
355
357
// Set the Accepts header for the server, depending on the dataType
356
358
xhr . setRequestHeader ( "Accept" , s . dataType && s . accepts [ s . dataType ] ?
You can’t perform that action at this time.
0 commit comments