From: Dave Methvin Date: Thu, 14 Nov 2013 02:31:07 +0000 (-0500) Subject: Ajax: Fix #14424. Use ActiveX in IE9+ on local files, close gh-1434. X-Git-Tag: 2.1.0-beta2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=498e0e6c9bf486a0b1f16b455d65fcbc6c43867e;p=jquery.git Ajax: Fix #14424. Use ActiveX in IE9+ on local files, close gh-1434. We can't feature detect ActiveX in IE11, but we can just call it and catch whatever error occurs, then try normal XHR. --- diff --git a/src/.jshintrc b/src/.jshintrc index ba16cd5db..a601fa051 100644 --- a/src/.jshintrc +++ b/src/.jshintrc @@ -20,6 +20,7 @@ "globals": { "jQuery": true, "define": true, - "module": true + "module": true, + "ActiveXObject": true } } diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 55d526a41..313dff5dc 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -5,6 +5,14 @@ define([ ], function( jQuery, support ) { jQuery.ajaxSettings.xhr = function() { + // Support: IE9+ + // IE can't get local files with standard XHR, only ActiveX + if ( this.isLocal ) { + try { + return new ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} + } + try { return new XMLHttpRequest(); } catch( e ) {}