From b2289f3ec174c5b22d130d8c36a5e07daa6d02df Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 5 Jan 2010 10:57:30 -0500 Subject: [PATCH] Try to use XMLHttpRequest in more cases in IE 7. Thanks to Matt Kruse and Sam Collett for the suggestions. Fixes #3623, #2849, #5338, and #5529. --- src/ajax.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index 37fb75b..182a88e 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -175,12 +175,13 @@ jQuery.extend({ traditional: false, */ // Create the request object; Microsoft failed to properly - // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available + // implement the XMLHttpRequest in IE7 (can't request local files), + // so we use the ActiveXObject when it is available // This function can be overriden by calling jQuery.ajaxSetup xhr: function() { - return window.ActiveXObject ? - new ActiveXObject("Microsoft.XMLHTTP") : - new XMLHttpRequest(); + return window.XMLHttpRequest && window.location.protocol !== "file:" || window.ActiveXObject ? + new window.XMLHttpRequest() : + new window.ActiveXObject("Microsoft.XMLHTTP"); }, accepts: { xml: "application/xml, text/xml", -- 1.7.10.4