是否可以从沙盒iframe打开新选项卡到新的浏览上下文?
让我们考虑一下main.html,有以下iframe:
<iframe src="iframe.html" sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts allow-popups" />
和iframe.html,有一个链接 <a target="_blank" href="otherpage.html">Link</a>
当从main.html单击链接时,otherpage.html将打开到沙盒上下文中,因此在Javascript中驱动的任何导航都会出现以下错误: Unsafe JavaScript attempt to initiate navigation for frame with URL
但是当链接target="_top"有时,允许otherpage.html执行Javascript驱动的导航.
我发现这是标准行为(来自http://dev.w3.org/html5/spec-preview/browsers.html)
设置允许顶部导航后,内容可以导航其顶级浏览上下文,但其他浏览上下文仍受沙盒导航浏览上下文标志的保护
问题:因此,在一个人无法同时更改main.html和otherpage.html的情况下,是否可以将链接打开到未经过安装的新标签中?
一个具体的例子:main.html由GoogleSite和BusinessObject报告中的其他页面生成(通过OpenDocument)
| 归档时间: |
|
| 查看次数: |
526 次 |
| 最近记录: |