IE Bug (window === top) === false

前端 未结 4 627
温柔的废话
温柔的废话 2020-12-01 12:59

In IE.

window === top; // false
window === window.window // false
window == top; // true
window == window.window // true

In FF3.6 & Chr

4条回答
  •  眼角桃花
    2020-12-01 13:38

    window tends to be the global object, rather than the page. window.window would be a property of that global object called "window" so in theory they should never be identical (===) but may be similar (==) since that global object is in the global scope.

    I haven't tested this, but as a guess, you may have better luck comparing self (the current page) and parent

提交回复
热议问题