IE 7 – Native xmlHttpRequest Not So Good

When I found out IE7 was going to implement a native javascript object, xmlHttpRequest, in addition to their own Microsoft.XMLHTTP object, I was thrilled. This meant once IE 6 was phased out of the world, all my ajax stuff wouldn’t need to check browser before proceeding. For the most I use ajax frameworks (http://www.ajaxpro.info/) that already have this built in but I do write my own xmlhttp request on occasion.

For an internal application I have an ajax search functionality built that queries a database and returns customers names on key entry. So I type in “Acm” I get a listing of:

Acmanda
Acmat
Acme

This is very similar to Google suggest, but I display the results in a fixed height div tag with auto scroll enabled. The ajax returns li tags with href tags around the company names. This works on IE 6, FF, and Safari. However in IE7, there is some real slowness to this. When I use Fiddler I see the Request returning from the AJAX calls but the results do not show up. I tried setting the page cache to nothing, but still no luck. I then ran into several articles questioning the XmlHttpRequest javascript object.

I also found out IE 7 is slow on some Google sites where a ton of XML traffic is being returned, like their Google Maps.

I started playing around with IE 7′s options, turning off Phishing filter, testing, no luck and so on. When I turned off the native XMLHttp support as seen below, my application ran perfectly fast on IE7. IE 7 is set up to fall back to the Microsoft.XMLHTTP Active X object if this gets turned off.

So this makes me wonder.

  • Did the IE 7 team really implement a native javascript XmlHttpRequest object?
  • If so, did they follow the spec?
  • If so, is their object code buggy or just plain slow

OR

  • Is their native XmlHttpRequest object really a javascript object or did they cut corners and implement an object that acts native but in all reality is a deformed active x object?
  • If so, why would you ship with this option turned on by default?

This has egg on the face written all over it.


Did you know you could browse IE with handheld computers? Modern technology makes everything more portable, like barcode readers and mobile computers. Zebra card printers are now portable, too, so you can print on the go!

Tim

A .NET, PHP, Marketing Guru authority, at least I hope I am. Reach me at tboland@gmail.com

24 thoughts on “IE 7 – Native xmlHttpRequest Not So Good

  1. Without a repro URL, it’s hard to understand where you’re hitting problems.

    Internally, the native object still uses MSXML, which is the same base that the older AX object used. Hence, it would be quite surprising to see slower performance on the new object.

  2. Tim says:

    Eric,
    I’ll see if I can get something I can show publicly to demo the difference. Like I said, the http request are being returned with data but IE7 doesn’t display the results with the same performance with the option turned off. I wasn’t aware they are both using MSXML, making wonder if this is a rendering issue.

  3. Tim says:

    I found this today explaining the difference of the new XmlHttpRequest oject verses the old Microsoft.XMLHTTP object.

    http://blogs.missiondata.com/?p=64
    His thought is that IE 7 doesn’t reuse the javascript for every request, like Microsoft.XMLHTTP does. This maybe a problem with the ajax framework I am using – Ajax Professional – http://www.ajaxinfo.net…. More to come on this issue.

  4. Tim says:

    I got the fix for for my application but I suspect this might be a problem for additional ajax frameworks. It looks like my call back function wasn’t executing for every request (again I believe it has to with IE7 not reusing the same javascript object for each request). I changed to pass the results directly to javascript var object.

    OLD javascript code:

    A_Class.Ajax.Search(keyValue,SearchBy, SearchWord_CallBack);

    function SearchWord_CallBack(response) {
    var word = response.value;
    if(response != null)
    {
    document.getElementById(“Display”).style.visibility = “visible”;
    document.getElementById(“Display”).innerHTML = word.substring(0,word.length – 4);
    }
    }

    New Code:

    var word = A_Class.Ajax.Search(keyValue, SearchBy).value;
    document.getElementById(“Display”).style.visibility = “visible”;
    document.getElementById(“Display”).innerHTML = word.substring(0,word.length – 4);
  5. Anthony says:

    This article answered my question and now I am not having any problems.

  6. Cobold says:

    Thank you very much, this article saved me hours! Stupid Microsoft and Ie

  7. [...] AJAX XMLHTTP: The IE Blog says: “to have your cross-browser AJAX work better with IE7, you really should be invoking the native XMLHttpRequest (the cross-browser one) first to see if it’s available before instantiating the ActiveX control, instead of the other way around.” Read this guys comments http://www.techtoolblog.com/archives/ie-7-native-xmlhttprequest-not-so-good [...]

  8. [...] are also concerns of it being much slower and buggier than XMLHTTP is. I guess a new implementation is less likely to be optimised, but it apparently has [...]

  9. Dan says:

    Doesn’t it make perfect sense though? If Microsoft needs to compete with Google to take over IT, then issuing a change that breaks Google’s products is an absolutely fantastic way of levelling the field.

    JSON for the win.

  10. Sean says:

    Madness….

    My Ajax program has been working like a charm in firefox, but in IE7 its dog…. You have just saved me….

    I removed the if httpObject is NOT present line like u did.

    Champion!

  11. Ralf says:

    I can only agree to use Microsoft.XMLHTTP Active X object in IE7 in favor of XMLhttpRequest object. Have been working on a little instant messenger today and the followin code did not work in IE7 with the XMLhttpRequest:

    function refreshIM()
    {
    script = ‘ajax/im_prog.php’;
    querystring = ‘a=refresh&refuid=’ + im_refuid;
    sendHTTPRequest2(script, querystring, ‘get’, refreshIM_callback);
    setTimeout(“refreshIM()”, (im_refresh_interval * 1000));
    }

    the problem was with setTimeout. It simply did not work in IE7 with XMLHttpRequest, only with Microsoft.XMLHTTP.

    There are no problems in Firefox 3 and Opera 9.51

  12. [...] the world needs more XMLHttpRequest wrappers… First saved by Ilovemovielogos | 6 days ago Comment on IE 7 – Native xmlHttpRequest Not So Good by Ralf First saved by rwright | 9 days ago Auto Resize iFrames – Part 2 First saved by msittig | 19 [...]

  13. yang says:

    Halo! I Just Want to give a big thumbs up to review your info, memorable once your writing. I’ll Come Back To blog Anda for a review Quick MORE. obat gagal ginjal . cara mengeluarkan batu ginjal

  14. karum says:

    So delish can get inspired writings on this blog. Not only inspire, but also beneficial to diverse aspects of life. thanks author. obat penghilang lipomaobat batuk yang tidak sembuh-sembuh

  15. karunya says:

    I can guess that the number of posts on this blog content only things smell opinion, but not so. inspire & written variety are also evident in this blog. obat infeksi jamur di miss v obat radang telinga tengah

  16. warum says:

    blogs have helped in overcoming the various tasks of the campus. dear very grateful to find this blog. thanks author. obat herbal asma

  17. tumbal says:

    once at home can linger here, a lot of the benefits of education in each of his writings. rasang anxious to share all the writings on this blog on my friends. – obat penyakit ulu hatiobat herbal gagal ginjal

  18. akang says:

    before knowing this blog so qualified, I could not underestimate me, I said “It’s probably just a coincidence.” But really, this blog is very qualified. pengobatan luka lambungpengobatan penyakit asma

  19. This is a great article. It gave me a lot of useful information. thank you very much.
    http://www.appbaixar.com

  20. vex3game.com says:

    I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job

  21. Happy Room says:

    Thanx for sharing such useful post, keep it up :)

  22. bloxorz says:

    The knowledge you share really changes me in life, I sincerely thank you for the things you have done, sure your blog will help more people. Sincerely thanks

  23. io games says:

    How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone!

  24. jenny singh says:

    So thankful for this. http://browserreview.net/chrome

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>