@Sunday Ironfoot said:
Nothing wrong with the 23 lines approach, you can do certain things such as loading the very latest version of MSXML supported by your browser. Here's an example....
<font face="Courier New" size="1">function createXmlHttpRequest()
{
if(typeof XMLHttpRequest != "undefined")
{
// For Firefox/Safari/Oprah etc.
return new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
var aVersions =
[
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp",
"Microsoft.XmlHttp"
];
// Keep trying each version of MSXML (starting from latest)
// until you find the one that's supported
for(var i = 0; i < aVersions.length; i++)
{
try
{
var oXhr = new ActiveXObject(aVersions[i]);
return oXhr;
}
catch(oError) {}
}
return null;
}
else
{
return null;
}
}</font>
Why do you care what version it creates?