Originariamente inviato da fcaldera
typeof(XMLHttpRequest()) dovrebbe andare con paio di parentesi tonde in più.. no?
no, stai verificando l'esistenza della funzione e non dell' oggetto restituito.

Se XMLHttpRequest non esiste XMLHttpRequest() non è nullo, è un errore perchè la funzione, appunto, non esiste.


Presa dalla EverGreen:
codice:
function getXMLHTTP() {
	var s = ['undefined','MSIE 5','Microsoft','Msxml2','.XMLHTTP'];
	return ((typeof(XMLHttpRequest)!=s[0])?new XMLHttpRequest():
		((window.ActiveXObject)?new ActiveXObject(
			((navigator.userAgent.indexOf(s[1])!=-1)?s[2]:s[3])+s[4]):
		false));
}