首页 > 解决方案 > 强制嵌套 iframe 中的任何链接在新窗口中打开

问题描述

我正在 Iframe 中显示一些第 3 方横幅,这些横幅正在通过javascript. 当我自己浏览网址时,横幅显示在 iframe 中,并且链接打开到新窗口。问题是当我试图将 url 广告到不同的 ptc 站点时。基本上这个网站在 iframe 中显示 url。因此,当我的 url 本身是一个 iframe 加载到另一个 iframe 中时,单击不起作用。以下是我当前的代码

<base target="_blank"> //in head section

<iframe sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-downloads" src="<?php echo $_SESSION['ad_url'];?>" frameborder="0" id="pgl" name="pgl" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%" onmouseover="on_mouseover(this)" onmouseout="on_mouseout(this)"></iframe>

正如我看到的嵌入我的 iframe 的页面的源代码在下面找到的

<iframe sandbox="allow-same-origin allow-scripts allow-forms" id="surfsite" name="surfsite" src="https://sitename.com/sitename.php?" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>

我怎样才能使它工作

标签: phpiframehyperlinktarget

解决方案


推荐阅读