Posted By

KernelPanic on 07/10/06


Tagged

browser XMLHttpRequest Switch


Versions (?)

Who likes this?

11 people have marked this snippet as a favorite

Taleamus
kgosser
jacksont123
vali29
SpinZ
cjwilburn
ckayra
seanpowell
allproweb
guo3823538
wirenaught


XMLHttpRequest


 / Published in: JavaScript
 

  1. var resObject;
  2.  
  3. if(navigator.appName.search(\"Microsoft\") > -1 ) {
  4. //resObject = new ActiveXObject(\"Microsoft.XMLHTTP\");
  5. resObject = new ActiveXObject(\"MSXML2.XMLHTTP\");
  6. }
  7. else {
  8. resObject = new XMLHttpRequest();
  9. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: MichaelM on October 13, 2009

Alternatively I prefer a more cut down method:

var xhr = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"),

You need to login to post a comment.