Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#6586 closed bug (duplicate)

JQuery 1.4.2 + IE + $.ajax

Reported by: scottchiefbaker Owned by:
Priority: Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

I have created a test case for a reproducible $.ajax bug with IE and JQuery 1.4.2. See the test case below for more information. I have confirmed this bug is present in IE7 and IE8.

http://www.perturb.org/tmp/ie-ajax.html

Attachments (1)

jquery-ie-ajax-test-case.zip (1.1 KB) - added by scottchiefbaker 13 years ago.
Test case

Download all attachments as: .zip

Change History (4)

comment:1 Changed 13 years ago by Bradley

Verified in IE7 (did not test IE8).

The problem seems to be related to a change in behavior with respect to the xhr method used in IE. Previously, the ActiveX Object was used whenever possible. In 1.4, the behavior is to use XMLHttpRequest except for local files.

jQuery 1.3:

xhr:function(){
    return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
}

jQuery 1.4.2:

xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
    function() {
        return new window.XMLHttpRequest();
    } :
    function() {
        try {
            return new window.ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {}
    }

By passing a function with the old behavior to the ajax setting "xhr", we can effectively force the old behavior and the problem goes away:

$.ajax({
    url: 'ajax.html',
    xhr: function() { return new window.ActiveXObject("Microsoft.XMLHTTP"); },
    success: ...
});

Changed 13 years ago by scottchiefbaker

Test case

comment:2 Changed 13 years ago by Bradley

Resolution: duplicate
Status: newclosed

Duplicate of #6480

comment:3 Changed 13 years ago by Bradley

Duplicate of #6298.

Note: See TracTickets for help on using tickets.