aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2013-11-13 21:31:07 -0500
committerDave Methvin <dave.methvin@gmail.com>2013-11-14 15:27:37 -0500
commit498e0e6c9bf486a0b1f16b455d65fcbc6c43867e (patch)
tree68d857ee8ceb357ef52133feae7ce11a3cc51575
parentd0782ed7e81a181f0541e1ce7c8cba0825a80299 (diff)
downloadjquery-498e0e6c9bf486a0b1f16b455d65fcbc6c43867e.tar.gz
jquery-498e0e6c9bf486a0b1f16b455d65fcbc6c43867e.zip
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.
-rw-r--r--src/.jshintrc3
-rw-r--r--src/ajax/xhr.js8
2 files changed, 10 insertions, 1 deletions
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 ) {}