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.
- http://ajaxian.com/archives/ie7-xmlhttprequest-native-or-not
- http://blogs.msdn.com/ie/archive/2006/01/23/516393.aspx#518174
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!
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.
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.
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.
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);
This article answered my question and now I am not having any problems.
Thank you very much, this article saved me hours! Stupid Microsoft and Ie
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.
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!
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
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
So delish can get inspired writings on this blog. Not only inspire, but also beneficial to diverse aspects of life. thanks author. obat penghilang lipoma – obat batuk yang tidak sembuh-sembuh
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
blogs have helped in overcoming the various tasks of the campus. dear very grateful to find this blog. thanks author. obat herbal asma
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 hati – obat herbal gagal ginjal
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 lambung – pengobatan penyakit asma
This is a great article. It gave me a lot of useful information. thank you very much.
http://www.appbaixar.com
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
Thanx for sharing such useful post, keep it up 🙂
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
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!
So thankful for this. http://browserreview.net/chrome
Very helpful article, Thank you for sharing. I love you
………………………………………………………………………………….