5

Probably every web developer is familiar with a pattern like this:

var xmlHttp = null;
if (window.XMLHttpRequest) {
  // If IE7, Mozilla, Safari, and so on: Use native object.
  xmlHttp = new XMLHttpRequest();
}
else
{
  if (window.ActiveXObject) {
     // ...otherwise, use the ActiveX control for IE5.x and IE6.
     xmlHttp = new ActiveXObject('MSXML2.XMLHTTP');
  }
}

But the question is - if there are multiple MSXML versions available on the client's PC (let's say 3.0, 5.0, 6.0), which one of them will be chosen by MSXML2.XMLHTTP call (notice no version suffix at the end)? Will it be the latest or - not necessarily?

And a side-question - is it possible to check which version was chosen?

Michael Myers
  • 188,989
  • 46
  • 291
  • 292
jayarjo
  • 16,124
  • 24
  • 94
  • 138
  • 1
    This is just for IE6 and earlier. Personally I'd not worry too much about which exact version, however take a look at http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx – James Nov 18 '11 at 21:19
  • IE7 is said to have slow and buggy native XMLHttpRequest implementation, so it's better to use ActiveXObject('xxx.XMLHTTP') again. And IE7 is going to be around for couple more years... so. I know that resource, I came from there, but it doesn't really answer the question. – jayarjo Nov 19 '11 at 14:45

1 Answers1

4

As stated in Using the right version of MSXML in Internet Explorer:

There’s a lot of confusion around the “version-independent” ProgID for MSXML. The version-independent ProgID is always bound to MSXML 3 (a lot of people think it picks up the latest MSXML that is on the box). This means the version independent ProgID and the “3.0” ProgIDs will return the same object.

That should be more than clear enough I would think, since we know MSXML2.XMLHTTP is a version independent ProgID. But a lot of Web page scrivners aren't Windows programmers I suppose.

For proof just use regedit and do a Find on this string.

As far as I can tell there isn't any "version" property to be checked.

Bob77
  • 13,167
  • 1
  • 29
  • 37