Getting XMLHttpRequest Object
The following JavaScript function is used on the maps.live.com web page in order to get hold of the XMLHttpRequest object, which is used to communicate asynchronously with the maps web server.
Code Listing 1. Getting the XMLHttpRequest Object from maps.live.com
function GetXmlHttp()
{
var a=null;
if(window.XMLHttpRequest)
a=new XMLHttpRequest;
else if(window.ActiveXObject)
try
{
a=new ActiveXObject("Msxml2.XmlHttp.6.0")
}
catch(b)
{
try
{
a=new ActiveXObject("Msxml2.XmlHttp.3.0")
}
catch(c)
{
try
{
a=new ActiveXObject("Msxml2.XMLHTTP")
}
catch(d)
{
try
{
a=new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e)
{
}
}
}
}
else
throw"XMLHTTP Required: Browser not supported";
return a
}
If you look at the source behind maps.live.com, the above code would be buried in a gigantic listing of JavaScript, which is basically one long string without any formatting.
This ‘release’ version of JavaScript has been optimized for size. All the comments inside the JavaScript have been removed. The variable names have been drastically shortened (for example, notice ‘a’ for the XMLHttpRequest object). Unnecessary spaces have been removed. Unneeded semi-colons (;) at the end of the lines have been removed.
However, with a little bit of manual formatting, you can see what maps.live.com is doing to obtain XMLHttpRequest object.
XMLHttpRequest Code Analysis from maps.live.com
The following figure shows various sections of the function that creates the XMLHttpRequest object for a given web browser on the live.com Maps page.
Figure 1. Analysis of Creating XMLHttpRequest Object on Live.com Maps

Get the XMLHttpRequest object on newer browsers
By using new XMLHttpRequest(), create a new variable on the newer versions of the popular browsers. Here the code looks for XMLHttpRequest object in window object (which is by default the global object).
if(window.XMLHttpRequest)
a=new XMLHttpRequest;
Get the XMLHttpRequest object on older Microsoft browsers
For the older IE browsers, use the ActiveXObject. Again, here the code looks for a global ActiveXObject (global meaning window). A series of checks are done for XMLHTTP objects on MSXML.
else if(window.ActiveXObject)
try
{
a=new ActiveXObject("Msxml2.XmlHttp.6.0")
}
catch(b)
{
try
{
a=new ActiveXObject("Msxml2.XmlHttp.3.0")
}
catch(c)
{
try
{
a=new ActiveXObject("Msxml2.XMLHTTP")
}
catch(d)
{
try
{
a=new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e)
{
}
}
}
}
Links for XMLHttpRequest
Following are some source code and article links regarding XMLHttpRequest.
Source for XMLHttpRequest Method on window class from ASP.NET AJAX Library
Methods in XMLHttpExecutor class from the Sys.Net Namespace from ASP.NET AJAX Library
Classes from the Sys.Net Namespace from ASP.NET AJAX Library
XMLHttpRequest and AJAX on Google Suggest
XMLHttpRequest and AJAX on maps.live.com
XMLHttpRequest and AJAX on Yahoo
XMLHttpRequest and AJAX on mapquest.com