问题描述
在IE11中查看我们的网站以查找现在已损坏的内容时,我们注意到以下代码未正确评估为true:
While looking over our site in IE11 to find out what's broken now, we noticed that the below code doesn't evaluate to "true" correctly:
this.isIEBrowser = false;
if (window.ActiveXObject){
this.isIEBrowser = true;
}
经过进一步调查,似乎 typeof(window.ActiveXObject) 会导致undefined,而在IE10模式下会产生功能。当我将 window.ActiveXObject 添加到监视列表时,它显示为一个函数类型。同样,如果我执行 typeof(window.ActiveXObject.prototype),我会获得IE11和IE10的object。
Upon further investigation, it appears that typeof(window.ActiveXObject) results in "undefined", whereas in IE10 mode, it results in "function". When I add window.ActiveXObject to the watch list, it shows as being a function type. Similarly, if I do typeof(window.ActiveXObject.prototype), I get "object" for both IE11 and IE10.
有没有人知道为什么会这样改变,或者我在哪里可以找到IE10和IE11之间这些类型的差异列表,以便我可以找出其他有哪些重大变化?
Does anybody know why this changed, or where I can find a list of these types of differences between IE10 and IE11 so that I can figure out what other breaking changes there are?
更新10/30/13:
当我把它放入,我原本以为这与IE11 javascript引擎中的Type评价有所不同。我已经意识到这个问题是特定于window.ActiveXObject对象的。所以我把这个问题的名称从IE11中的Typeof差异更改为IE11中的window.ActiveXObject差异
When I put this in, I had originally thought this was a difference with Type evaluation in the IE11 javascript engine. I've since come to realize that this issue is specific to the window.ActiveXObject object. So I've changed the name of this question from "Typeof difference in IE11" to "window.ActiveXObject difference in IE11"
推荐答案
您不能对IE11使用该检查:
You can't use that check for IE11:
这篇关于IE11中的window.ActiveXObject差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!