views:

225

answers:

4

There are two progid's. I've seen both used.

Anyone have any insight as to when I should use one, versus the other?

+1  A: 

Maybe not exactly the answer you want, but that, if you are developping an Ajax application, I'd say you shouldn't use either of those : instead, you should use a Javascript Framework that will deal with browser compatibility, and not re-fight that battle.

For instance (there are many more) :

And, as a sidenote, they'll get you plenty of other useful stuff ;-)

Pascal MARTIN
Seconded. There is no need to meddle with browser specific implementations here, except maybe for some *really* specific stuff that can't be done cross browser. Use a framework and be done with it.
Pekka
Can I download binary blobs using the ajax capability in jQuery? Any of the above?
Cheeso
A: 

This code takes care of both IE and firefox.

try {
  XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP");
} catch (exception1) {
  try {
    XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (exception2) {
    XMLHttpRequestObject = false;
  }
}

if (!XMLHttpRequestObject && window.XMLHttpRequest) {
  XMLHttpRequestObject = new XMLHttpRequest();
}
Q_the_dreadlocked_ninja
+1  A: 

You should definitely not use Microsoft.XmlHttp.

From the Microsoft XML Team blog: Using the right version of MSXML in Internet Explorer:

MSXML2 vs. Microsoft namespace – I’ve also seen a lot of code that instantiates the "Microsoft.XMLHTTP" ActiveX object rather than the MSXML2.XMLHTTP.3.0 or MSXML2.XMLHTTP.6.0 if you’re using 6.0. The “Microsoft” namespace is actually older and is only implemented in MSXML3 for legacy support. It’s unfortunate we used the “better” name on the older version, but stick to the “msxml2” namespace when instantiating objects.

Ian Boyd