Permalink
Browse files

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.
  • Loading branch information...
dmethvin committed Nov 14, 2013
1 parent d0782ed commit 498e0e6c9bf486a0b1f16b455d65fcbc6c43867e
Showing with 10 additions and 1 deletion.
  1. +2 −1 src/.jshintrc
  2. +8 −0 src/ajax/xhr.js
@@ -20,6 +20,7 @@
"globals": {
"jQuery": true,
"define": true,
"module": true
"module": true,
"ActiveXObject": true
}
}
@@ -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 ) {}

0 comments on commit 498e0e6

Please sign in to comment.