From 498e0e6c9bf486a0b1f16b455d65fcbc6c43867e Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 13 Nov 2013 21:31:07 -0500 Subject: [PATCH] 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. --- src/.jshintrc | 3 ++- src/ajax/xhr.js | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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 ) {} -- 2.39.5