php - 强制嵌套 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>
我怎样才能使它工作
解决方案
推荐阅读
- javascript - 脚本仅适用于 Gatsby/React 中的页面刷新
- django-rest-framework - django-rest-framework-simplejwt 禁用刷新
- python - 在终端中运行 python 会出现错误的版本
- pattern-matching - 模式匹配 Ocaml 中的函数
- flutter - 颤振/飞镖中工厂方法的目的是什么?
- mongodb - 无法连接到 Mac 上的 MongoDB 服务器
- unity3d - 为什么“Cols”是一个空数组?
- json - 在 Angular 中将 JSON 转换为对象类型
- azure-devops - Azure Pipelines:批量批准部署到环境
- php - PHP - 将表单选择选项中的表单值插入数据库