javascript – MSXML2.XMLHTTP请求将选择什么版本,没有版本后缀?

前端之家收集整理的这篇文章主要介绍了javascript – MSXML2.XMLHTTP请求将选择什么版本,没有版本后缀?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

可能每个Web开发人员都熟悉这样的模式:

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');
  }
}

但问题是 – 如果客户端的PC上有多个MSXML版本(假设是3.0,5.0,6.0),那么其中一个版本将由MSXML2.XMLHTTP调用选择(最后注意没有版本后缀)?它会是最新的还是 – 不一定?

还有一个问题 – 是否可以检查选择了哪个版本?

最佳答案
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.

我认为这应该是非常明确的,因为我们知道MSXML2.XMLHTTP是一个独立于版本的ProgID.但是我认为很多网页编写者都不是Windows程序员.

为了证明,只需使用regedit并对此字符串执行查找.

据我所知,没有任何“版本”属性需要检查.

原文链接:https://www.f2er.com/js/429497.html

猜你在找的JavaScript相关文章