]> source.dussan.org Git - jquery.git/commitdiff
Ajax: Fix #14424. Use ActiveX in IE9+ on local files, close gh-1434.
authorDave Methvin <dave.methvin@gmail.com>
Thu, 14 Nov 2013 02:31:07 +0000 (21:31 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Thu, 14 Nov 2013 20:27:37 +0000 (15:27 -0500)
We can't feature detect ActiveX in IE11, but we can just call
it and catch whatever error occurs, then try normal XHR.

src/.jshintrc
src/ajax/xhr.js

index ba16cd5db47157930be7af51fcac5c8c22f7ab8d..a601fa05115912ba04a1f6e33d4e503b387e92fd 100644 (file)
@@ -20,6 +20,7 @@
        "globals": {
                "jQuery": true,
                "define": true,
-               "module": true
+               "module": true,
+               "ActiveXObject": true
        }
 }
index 55d526a4191339c16ac4908a6be4771aee57e4ac..313dff5dccead47f85378de33e33bcbf5d230465 100644 (file)
@@ -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 ) {}