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.
October 26th, 2006 at 2:29 pm
Your saying IE7 doesn’t reuse XmlHttpRequest object like the rest of the web browsers?
October 26th, 2006 at 4:48 pm
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()
October 27th, 2006 at 4:33 am
I have the same problem in IE7. All the other browsers support multiple requests.
Any solution?
October 27th, 2006 at 10:18 am
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?
December 29th, 2006 at 12:32 pm
Many thanks for this page - it helped me make a simple fix to the Bitflux livesearch code so that it now works on IE7 :)
January 10th, 2007 at 9:01 am
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
February 13th, 2007 at 3:25 am
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?