giovedì, novembre 09, 2006

latest version of getXDOC don't work in IE 4 because in IE 4
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:

Andrea Giammarchi ha detto...

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 :)

Andrea Giammarchi ha detto...

oops ... this is the correct link