]> source.dussan.org Git - jquery.git/commitdiff
Try to use XMLHttpRequest in more cases in IE 7. Thanks to Matt Kruse and Sam Collett...
authorjeresig <jeresig@gmail.com>
Tue, 5 Jan 2010 15:57:30 +0000 (10:57 -0500)
committerjeresig <jeresig@gmail.com>
Tue, 5 Jan 2010 15:57:30 +0000 (10:57 -0500)
src/ajax.js

index 37fb75b557e0a75e3b0c5379f4124f8060e189b2..182a88e5a7f6572dfcba7431971d208736c0ec02 100644 (file)
@@ -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",