2

I noticed TJ Holowaychuk's superagent library ("Ajax with less suck") try's several ActiveXObject methods for IE when generating a cross browser XHR object:

// ...if normal browser:
  return new XMLHttpRequest;
} else {
  try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}
  try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}
  try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}
  try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}
}

The full code: https://github.com/visionmedia/superagent/blob/master/build/build.js#L359-376

In jQuery, this is not attempted, and I'm curious what's going on here.

You can search jQuery source for 'ActiveXObject' and see for yourself: http://code.jquery.com/jquery-1.8.2.js

When does new ActiveXObject('Microsoft.XMLHTTP'); throw and waterfall down to the other options?

Devin Rhode
  • 23,026
  • 8
  • 58
  • 72
  • 1
    Potentially useful http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx – Devin Rhode Oct 27 '12 at 07:57
  • It does not 'waterfall'.. as it looks, at least, 'coz MSXML6 is **before** the MSXML3 .. – c69 Oct 27 '12 at 09:10

0 Answers0