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并对此字符串执行查找.

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

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...