Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JS window.location.href和跨源策略_Javascript_Same Origin Policy - Fatal编程技术网

Javascript JS window.location.href和跨源策略

Javascript JS window.location.href和跨源策略,javascript,same-origin-policy,Javascript,Same Origin Policy,正如我所知,当域a.com的iFrame试图在域b.com上获取或设置top.location.href时,它会破坏同一来源策略并抛出“拒绝访问”错误 什么会导致这样的行为不起作用??在我们的测试应用程序中,iframe从www.test-a.com成功地将www.test-b.com上的top.location.href设置为other-site.com时,我感到非常惊讶 这个问题特别是关于使用top.location.href='other site.com'而不是top.location=

正如我所知,当域a.com的iFrame试图在域b.com上获取或设置
top.location.href
时,它会破坏同一来源策略并抛出“拒绝访问”错误

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

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