8

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

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

informatik01
  • 16,038
  • 10
  • 74
  • 104
Cheeso
  • 189,189
  • 101
  • 473
  • 713

4 Answers4

7

You should definitely not use Microsoft.XmlHttp.

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

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
  • 246,734
  • 253
  • 869
  • 1,219
0

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
  • 395,085
  • 80
  • 655
  • 663
  • 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 Dec 17 '09 at 10:59
  • Can I download binary blobs using the ajax capability in jQuery? Any of the above? – Cheeso Dec 17 '09 at 22:22
  • 2
    Hmm.. not so sure, Vanilla js is the best performing approach. – Nikos Feb 13 '14 at 17:43
0

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();
}
Cheeso
  • 189,189
  • 101
  • 473
  • 713
Q_Mlilo
  • 1,729
  • 4
  • 23
  • 26