2

据我所知,当来自域 a.com 的 iFrame 尝试top.location.href在域 b.com 上获取或设置时,它会破坏同源策略并引发“拒绝访问”错误。

什么会导致这种行为不起作用?在我们的测试应用程序中,iframe 从站点 www.test-a.com 成功设置top.location.href到 www.test-b.com 到 other-site.com 时,我感到非常惊讶?

问题特别是关于使用top.location.href = 'other-site.com'而不是top.location = 'other-site.com'

4

0 回答 0