【问题标题】:Link inside iframe wont workiframe 内的链接不起作用
【发布时间】:2016-03-28 14:44:32
【问题描述】:

这让我现在完全发疯了。我制作的 iframe 内页面上的链接 (http://ns.nl) 不起作用 (http://newsoundsofeurope.com/videos/playlisttest)。鼠标单击后 Chrome 不会执行任何操作。 Firefox 只是在 iframe 中打开一个空白页面。有人可以帮忙吗?

带有 iframe 的页面:

<html>
<head>
</head>
<body>
<iframe src="playlist_iframe.php"></iframe>
</body>
</html>

iframe 内的页面:

<html>
<head>
</head>
<body>
<a href="http://ns.nl" target="_self"><img src="026.png"/></a>
</body>
</html>

【问题讨论】:

    标签: html iframe hyperlink


    【解决方案1】:

    删除target="_self 即可。

    【讨论】:

      【解决方案2】:

      如果你想用一个新页面打开那个链接,你需要设置 target="_blank"

      <a href="http://ns.nl" target="_blank"><img src="026.png"/></a>
      

      还需要在 iframe 中设置 'allow-popups' 权限

      <iframe src="playlist_iframe.php" sandbox="allow-popups"></iframe>
      

      https://www.w3schools.com/tags/att_iframe_sandbox.asp

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-01-23
        • 2023-03-20
        • 2013-05-31
        • 1970-01-01
        • 1970-01-01
        • 2015-10-02
        • 2012-04-15
        • 1970-01-01
        相关资源
        最近更新 更多