Skip to content
Permalink
Browse files

Fix #14475. Use IE11-friendly detect for proper XHR object.

We don't seem to have test cases for local file access.
  • Loading branch information...
dmethvin committed Nov 14, 2013
1 parent 473c7db commit 9ca87af44c7c606e124ee4d2110cecf5d1ea5f5a
Showing with 3 additions and 7 deletions.
  1. +3 −7 src/ajax/xhr.js
@@ -6,13 +6,9 @@ define([

// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
// Support: IE6+
// XHR cannot access local files, always use ActiveX for that case
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :

1 comment on commit 9ca87af

@Sheep-y

This comment has been minimized.

Copy link

commented on 9ca87af May 8, 2014

This would not work. IE 11 will return undefined for window.ActiveXObject, likely to disguise as modern browser to old code.

As others have commented in the ticket, it is not fixed.

In IE 11, you'll need to actually try to create an ActiveX:

var activex; // save activex somewhere so that it only need to check once
if ( activex === undefined ) try { new ActiveXObject("MSXML2.XMLHTTP.3.0"); activex = true; } catch (e) { activex = false }
xhr = activex ? (has active x) : createStandardXHR;
Please sign in to comment.
You can’t perform that action at this time.