From a1965f210233c38095549196bf98c160159f7d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Mon, 30 Mar 2015 20:00:38 +0200 Subject: [PATCH] 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 gh-1684 Closes gh-2183 --- src/ajax/xhr.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index ac5bc81d91..7d3ac0f342 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -19,7 +19,19 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 // Although this check for six methods instead of eight // since IE also does not support "trace" and "connect" - /^(get|post|head|put|delete|options)$/i.test( this.type ) && + // + // Support: IE 10-11 + // IE seems to error on cross-domain PATCH requests when ActiveX XHR + // is used. Use the following strategy: + // 1. If request is local, use the ActiveX XHR. + // 2. Otherwise, in IE9+ always use the native XHR. + // 3. Otherwise, in IE8 if request type is *not* included in the following + // list, use the ActiveX XHR. + // 4. Otherwise, use the native XHR. + // jshint -W018 + ( !( document.documentMode < 9 ) || + // jshint +W018 + /^(get|post|head|put|delete|options)$/i.test( this.type ) ) && createStandardXHR() || createActiveXHR(); } :