Experiences of an Inland Empire Dad

Internet Explorer 7.0 and the Native XMLHTTPRequest Object

If clients turn off ActiveX support on their browser, bad things can happen if you don’t program for it.

The following code:

var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 

would break.  There is now a native XMLHTTPRequest object, similar to what the non-IE browsers do.

var xmlHttp = new XMLHttpRequest();
No ActiveX object is needed.  Here is the code that needs to be added to check the support of the native XMLHTTPRequest object

if (window.XMLHttpRequest)
{
   var xmlHttp = new XMLHttpRequest();
}
else
{
    if (window.ActiveXObject)
    {
        var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
}