Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What version will be chosen by MSXML2.XMLHTTP request, without version suffix?

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?

like image 518
jayarjo Avatar asked Oct 09 '22 10:10

jayarjo


1 Answers

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.

like image 61
Bob77 Avatar answered Oct 13 '22 12:10

Bob77