微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.jb51.cc/js/429497.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐