Msxml3.XMLHTTP In which case is it used?

2

I was reading the following topic: Ajax request with pure Javascript (without APIs)

There they show the following line of code:

var XMLHttpFactories = [
    function () {return new XMLHttpRequest()},
    function () {return new ActiveXObject("Msxml2.XMLHTTP")},
    function () {return new ActiveXObject("Msxml3.XMLHTTP")},
    function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];

I know that for Firefox , Opera 8.0+ , Safari = XMLHttpRequest(); is the basicon

For Internet Explorer = Msxml2.XMLHTTP

Which browsers use Microsoft.XMLHTTP and Msxml3.XMLHTTP ?

Currently here in the company we use Ajax requests only with XMLHttpRequest() , Msxml2.XMLHTTP and Microsoft.XMLHTTP and wanted to know if it would be necessary to add Msxml3.XMLHTTP

I've been researching about it and found nothing, if you can give me a light I would be very grateful ...

    
asked by anonymous 27.08.2014 / 15:26

1 answer

1

XMLHttpRequest

The native object of modern browsers

Msxml2.XMLHTTP

Also valid as MSXML2.XMLHTTP.3.0 according to the knowledge base of no MSDN base knowledge

Microsoft.XMLHTTP

Internet Explorer 5, as if someone still remembers it: p

Finally, an improved version of your code, also coming from the MSDN discussion channel with link above, if the native object does not exist:

if( !window.XMLHttpRequest )
{
  window.XMLHttpRequest = function()
  {
    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 ) { }
    try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch( e ) { }
    throw "Could not create XMLHTTP object.";
  }
}

That's because this article in one of the MSDN bloogs, the approach in which you list all possible objects and then iterate through the collection and instance to the one with the largest ProgID , is wrong. And the reasons presented, here translated, are:

  • Compatibility - We do our best to maintain compatibility throughout the versions of MSXML, however, early versions such as MSXML 3 and MSXML 4 were implemented in the "Wild West" of the emergence of XML and much has been learned and improved over that time.

    In addition, MSXML 5 for Microsoft Office Appointments was created with a specific focus for Microsoft Office scenarios. Sometimes for design or implementation issues you have to change things that affect the behavior of MSXML between your different versions

    By iterating a collection of MSXML objects you open your Application for the potential risk of "bumping into" one of these differences unexpectedly.

  • Robuztez - We can not fix all the bugs found in each of the many versions of MSXML and therefore we created MSXML6 (latest sup>) and MSXML3 (the most widely developed ), which have received large investments.

  • Testing costs - The more versions of MSXML your Application potentially depends on, the more versions you have to test it before you apply it to your clients.

    / li>

[1] Translator's Note: As of the article's date in 2006

    
27.08.2014 / 15:54