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?