Our Blog. We have some things we'd like to share.

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.

Tagged:

7 Responses to “IE7 adds native XMLHTTPRequest object”

  1. 1

    October 26th, 2006 @ 2:29 pm Tim Hollered:

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

  2. 2

    October 26th, 2006 @ 4:48 pm steveny Hollered:

    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. 3

    October 27th, 2006 @ 4:33 am Tom Hollered:

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

  4. 4

    October 27th, 2006 @ 10:18 am Tim Hollered:

    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. 5

    December 29th, 2006 @ 12:32 pm Nick Smith Hollered:

    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. 6

    January 10th, 2007 @ 9:01 am cbmeeks Hollered:

    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. 7

    February 13th, 2007 @ 3:25 am Gustave Hollered:

    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 Response


Cincinnati 513.298.1865

Virginia 7875 Promontory Court Dunn Loring, VA 22027

Kentucky 12910 Shelbyville Road Suite 310 Louisville, KY 40243 502.245.6756

© 2010 Mission Data