Skip to main content

Bug Tracker

Side navigation

#6586 closed bug (duplicate)

Opened May 19, 2010 10:10PM UTC

Closed May 22, 2010 02:56PM UTC

Last modified March 13, 2012 08:30PM UTC

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:

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.

Attachments (1)
Change History (3)

Changed May 21, 2010 09:43PM UTC by Bradley comment:1

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:

    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:

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

Changed May 22, 2010 02:56PM UTC by Bradley comment:2

resolution: → duplicate
status: newclosed

Duplicate of #6480

Changed May 22, 2010 03:09PM UTC by Bradley comment:3

Duplicate of #6298.