Will These Activexobject And Xmlhttprequest Checks Apply For Any Other Browser Than Ie6?
Solution 1:
Yes, I believe there are other browsers. The checks you show are trying to detect IE by looking for browsers with ActiveX support (IE*), but no XMLHttpRequest support (IE6-). However if the ie7xmlhttp flag is presumably initialized to null or undefined, then any non-IE browser that doesn't have XMLHttpRequest support will be treated similarly since if(typeof XMLHttpRequest == "undefined" || !ie7xmlhttp) {
will be true in those cases.
Thus, pretty much any older browser w/out XMLHttpRequest support will fall into the if
block that tries to shim the XMLHttpRequest API. Not that there are a lot of people using them, but I'm sure they're out there. (e.g. particularly old versions of FF, Opera, Safari... lesser known mobile browsers maybe... that sort of thing.)
BTW, Microsoft's XMLHttpRequest documentation recommends this code snippet for x-platform XMLHttpRequest construction, which I recommend:
functiongetXMLHttpRequest()
{
if (window.XMLHttpRequest) {
returnnewwindow.XMLHttpRequest;
}
else {
try {
returnnewActiveXObject("MSXML2.XMLHTTP.3.0");
}
catch(ex) {
returnnull;
}
}
}
Post a Comment for "Will These Activexobject And Xmlhttprequest Checks Apply For Any Other Browser Than Ie6?"