【问题标题】:Difference in behavior using parent.window.location.replace vs parent.location.replace in IE8在 IE8 中使用 parent.window.location.replace 与 parent.location.replace 的行为差异
【发布时间】:2010-09-09 10:21:23
【问题描述】:

场景:从跨域 iframe 中更改父窗口的 URL。

IE-8 中,parent.location.replace("http://google.com"); 工作正常,而 parent.window.location.replace("http://google.com"); 不工作(抛出 Permission Denied)。

当我执行 parent.location 与 parent.window.location 时有什么区别?为什么这仅在 IE 8 中有所不同(因为两者在 FF/Chrome 中都可以正常工作)

【问题讨论】:

    标签: iframe cross-domain


    【解决方案1】:

    这对我来说是一个巨大的帮助 - 在理解类似的情况... re: window.foo and just foo...我认为它与窗口的对象相关,而不仅仅是 javascript-land 中的对象.

    http://davidbcalhoun.com/2011/checking-for-undefined-null-and-empty-variables-in-javascript

    在他的帖子底部附近...(希望有帮助)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-09
      • 1970-01-01
      • 2018-01-02
      • 2011-01-05
      • 1970-01-01
      • 1970-01-01
      • 2012-09-14
      • 1970-01-01
      相关资源
      最近更新 更多