🌐 AI搜索 & 代理 主页
Skip to content

Commit a1965f2

Browse files
committed
Ajax: Use the native XHR for all non-local requests in IE9+
IE throws an error on cross-domain PATCH requests if issued via the ActiveX interface. This commit switches the logic to use the native XHR in all non-local requests. Fixes jquerygh-1684 Closes jquerygh-2183
1 parent 8992ac8 commit a1965f2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/ajax/xhr.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
1919
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
2020
// Although this check for six methods instead of eight
2121
// since IE also does not support "trace" and "connect"
22-
/^(get|post|head|put|delete|options)$/i.test( this.type ) &&
22+
//
23+
// Support: IE 10-11
24+
// IE seems to error on cross-domain PATCH requests when ActiveX XHR
25+
// is used. Use the following strategy:
26+
// 1. If request is local, use the ActiveX XHR.
27+
// 2. Otherwise, in IE9+ always use the native XHR.
28+
// 3. Otherwise, in IE8 if request type is *not* included in the following
29+
// list, use the ActiveX XHR.
30+
// 4. Otherwise, use the native XHR.
31+
// jshint -W018
32+
( !( document.documentMode < 9 ) ||
33+
// jshint +W018
34+
/^(get|post|head|put|delete|options)$/i.test( this.type ) ) &&
2335

2436
createStandardXHR() || createActiveXHR();
2537
} :

0 commit comments

Comments
 (0)