la funzione più usata per creare l'oggetto è questa

codice:
if (typeof XMLHttpRequest != "undefined") {
   // Browser w3c compatibile
   XMLHttpReqObj = new XMLHttpRequest();
}

else {
   // Explorer
   try {
   XMLHttpReqObj = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
         XMLHttpReqObj = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch (e) {
         XMLHttpReqObj = null;
      }
   }
}
Il primo costrutto if discrimina già il caso in cui si stia usando Explorer oppure no