IE7 adds native XMLHTTPRequest object

The recently released IE7 supports a native XMLHTTPRequest object. On the surface this can be considered a good thing and should be commended. However, to the people that erroneously (in hindsight) assumed that…

window.XMLHttpRequest == ! (not) IE

…they are in for some strange behavior (here, here, here, and here for example).

The problem occurs when the code is optimized for non-IE browsers and does not recreate the XMLHTTPRequest object on each event. Back when “window.XMLHttpRequest == !IE” was true, this code worked as expected: IE browsers created a new XMLHttpRequest object on each event and non-IE browsers reused the same XMLHttpRequest object. Now IE7 will correctly process the first event but then fails on the second (and subsequent) requests because you still can’t reuse XMLHttpRequest objects.

We chose to just remove the optimization all together and recreate the object on each event for all browsers. Others may wish to come up with some other check that will allow them to keep it.

del.icio.us:IE7 adds native XMLHTTPRequest object digg:IE7 adds native XMLHTTPRequest object spurl:IE7 adds native XMLHTTPRequest object wists:IE7 adds native XMLHTTPRequest object simpy:IE7 adds native XMLHTTPRequest object newsvine:IE7 adds native XMLHTTPRequest object blinklist:IE7 adds native XMLHTTPRequest object furl:IE7 adds native XMLHTTPRequest object reddit:IE7 adds native XMLHTTPRequest object fark:IE7 adds native XMLHTTPRequest object blogmarks:IE7 adds native XMLHTTPRequest object Y!:IE7 adds native XMLHTTPRequest object smarking:IE7 adds native XMLHTTPRequest object magnolia:IE7 adds native XMLHTTPRequest object segnalo:IE7 adds native XMLHTTPRequest object gifttagging:IE7 adds native XMLHTTPRequest object

7 Responses to “IE7 adds native XMLHTTPRequest object”

  1. Tim Says:

    Your saying IE7 doesn’t reuse XmlHttpRequest object like the rest of the web browsers?

  2. steveny Says:

    Pre IE7 you would instantiate the object differently than you would in Firefox, Safari, Opera, etc…

    For IE (pre 7) you would either use:
    new ActiveXObject(’Msxml2.XMLHTTP’) or new ActiveXObject(’Microsoft.XMLHTTP’)

    In IE 7 and other browsers you would use:
    new XMLHttpRequest()

  3. Tom Says:

    I have the same problem in IE7. All the other browsers support multiple requests.
    Any solution?

  4. Tim Says:

    Maybe I understand this better now: The ajax code checks for IE, if so it uses Microsoft.XMLHttp object EVEN though IE7 now comes with XmlHttpRequest. Can we force IE7 to respond to the Microsoft.XMLHttp object?

  5. Nick Smith Says:

    Many thanks for this page - it helped me make a simple fix to the Bitflux livesearch code so that it now works on IE7 :)

  6. cbmeeks Says:

    It seems like IE7 has “fixed” problems that should make them more compliant to standards. But these fixes are breaking old “hacks” and work-arounds that are everywhere.

    It’s good that IE7 is more standard-based but something has to give.

    http://www.codershangout.com

  7. Gustave Says:

    I don’t really understand what i have to change in the livesearch code to get it working in IE7. Can you give me an example?

Leave a Reply