如何为<a> tags in iframe?</a>使用target = blank

时间:2014-11-19 06:58:44

标签: html href target

我的网页是主页面中的iframe。并在iframe中添加了<a href="http://www.google.co.kr" target="_blank"> google </a>之类的链接。但是,链接不起作用。 target = '_ self'运行良好,target = '_ blank'未运行。它在主页面上工作正常。

为什么会这样?

2 个答案:

答案 0 :(得分:2)

我确定该问题与沙箱属性有关。您似乎可以添加属性“allow-top-navigation”,将链接更改为“target = _parent”并且应该可以正常工作。

以下是一些文档from the MDN

关于沙箱attr:

  • allow-top-navigation:允许嵌入式浏览上下文将内容导航(加载)到顶级浏览上下文。如果未使用此关键字,则不允许此操作。

答案 1 :(得分:0)

检查iframe沙箱属性 - “允许顶部导航” - http://www.w3schools.com/tags/att_iframe_sandbox.asp

相关问题