diff options
author | jeresig <jeresig@gmail.com> | 2010-01-05 10:57:30 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-01-05 10:57:30 -0500 |
commit | b2289f3ec174c5b22d130d8c36a5e07daa6d02df (patch) | |
tree | 39df83d2c3932dd826cbd9180c50f542b2dc2243 /src/ajax.js | |
parent | 25ee9cee26c9c4170693908fbe233154e8158d69 (diff) | |
download | jquery-b2289f3ec174c5b22d130d8c36a5e07daa6d02df.tar.gz jquery-b2289f3ec174c5b22d130d8c36a5e07daa6d02df.zip |
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.
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ajax.js b/src/ajax.js index 37fb75b55..182a88e5a 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", |