try catch are not supported, but IE4 also know the CC
so we need a check for this..
and how can we make try catch invisible to IE4?
using a 'simple' eval
IE4 still don't work well, but is the better I can do ^_^;;
Also notice that the correct object for a XHR is
Msxml2.XMLHTTP, not DOMDocument!
getXDOC modified version:
function getXDOC(){
if(typeof(window.XMLHttpRequest)!='undefined')
return new XMLHttpRequest();
/*@cc_on
if(!(@_jscript_version<4)){
return eval('(function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e__x){return new ActiveXObject("Msxml2.XMLHTTP.3.0");}}())');
}
@*/
return new ActiveXObject('Msxml2.XMLHTTP.3.0');
}
Sorry Andrea, I use conditional compilation again -.-
2 commenti:
You use conditional comments every where nd I don't like it very much.
However, this is what I think about this kind of function
bye :)
oops ... this is the correct link
Posta un commento