IE7 and no native XMLHttpRequest support

Michael Schwarz on Monday, July 3, 2006

This weekend I had a deep look on the native XMLHttpRequest support with the new Internet Explorer version 7 which is still in beta. If you do a Google search for "native xmlhttp support ie [1]" you will read that everyone is happy with this native support. Yes, it is the first step to have XMLHttpRequest on every PC. Ajax developers have changed their JavaScript source code to support this new object, this is great!

But, what is if this is still missing?

With Internet Explorer version 7 you get native support in JavaScript, but you will get a new option to disable this again.

Upps, this is very interessting. So, web developers still have to deal with this problem if there is XMLHttp support or not. With IE 7 you have to first check if XMLHttpRequest ist available or not. In older scripts you will find something like this:

if(window.XMLHttpRequest == "undefined") { window.XMLHttpRequest = function() { // here come's the IE ActiveXObject code } }

Hm, if you run this code with IE 7 and deactivated XMLHttpRequest native support you don't get the old ActiveXObject. window.XMLHttpRequest will be of type object on IE 7, if native support is activated or not. To check this you have to try if you can create an instance of this object.

I have modified my Ajax.NET Professional library [2] and hopefully get it working in all scenarios. The only thing that is not working currently is if there is not support of an IFrame on Internet Explorer or very old Mozilla/Firefox/Netscape browsers that have not XMLHttpRequest object be default. If you have a look around you will see that there isn't 1% using such old web browsers.

But, what do should not forget is that there are a lot of users who have disabled ActiveX (and may disable the native support in IE 7, maybe from the company's group policies [3]).

Try to run web sites using disabled native XMLHttpRequest support or disabled ActiveX support!!