admin管理员组文章数量:1320864
For some reason, using the
window.top === window
condition in IE8 always evaluates to false (in other browsers it works fine). What is the reason for this, and is there any other way for this condition to work cross-browser?
Thanks,
Joel
For some reason, using the
window.top === window
condition in IE8 always evaluates to false (in other browsers it works fine). What is the reason for this, and is there any other way for this condition to work cross-browser?
Thanks,
Joel
Share Improve this question asked Feb 13, 2011 at 12:35 JoelJoel 6,10712 gold badges44 silver badges59 bronze badges 2- ...and definitely not within a frame? :P – alex Commented Feb 13, 2011 at 12:37
- @alex - yup... i am using this code inside a page that is sometimes served inside an iframe. I need to check if it is the top window or an iframe – Joel Commented Feb 13, 2011 at 12:43
1 Answer
Reset to default 13It's a very plicated topic, but the short version is, use ==
when paring windows, not ===
, because of the "internal" vs. "external" reference aspect of it. You'll find that (for instance) window === self
is false on some browsers.
本文标签: javascriptwindowtopwindow false condition in IE8Stack Overflow
版权声明:本文标题:javascript - window.top === window false condition in IE8 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742016174a2413812.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论