php allow furl open,如何阻止來自iframe的彈出窗口?
8
If you are wanting to block something like POP up ads or something coming from a website you are showing in an IFRAME - it's fairly easy.
如果你想阻止像POP廣告這樣的東西或來自你在IFRAME中展示的網站的東西 - 這很容易。
Make a framefilter.php and javascriptfilter.php which your iframe points to. You can modify it to meet your needs such as the onload blah blah and etc. But as/is - it's been working fine for me for quite a while. Hope it helps.
制作一個iframe指向的framefilter.php和javascriptfilter.php。您可以修改它以滿足您的需求,例如onload blah blah等等。但是/是 - 它已經為我工作了很長一段時間。希望能幫助到你。
Replace your standard IFRAME HTML with this:
用以下內容替換標准IFRAME HTML:
If you can see this, your browser doesn't
understand IFRAMES. However, we'll still
link
you to the page.
Framefilter.php
//Get the raw html.
$furl=trim($_GET["furl"]);
$raw = file_get_contents($furl);
$mydomain="http://www.yourdomainhere.com/";
//Kill anoying popups.
$raw=str_replace("alert(","isNull(",$raw);
$raw=str_replace("window.open","isNull",$raw);
$raw=str_replace("prompt(","isNull(",$raw);
$raw=str_replace("Confirm: (","isNull(",$raw);
//Modify the javascript links so they go though a filter.
$raw=str_replace("script type=\"text/javascript\" src=\"","script type=\"text/javascript\" src=\"".$mydomain."javascriptfilter.php?jurl=",$raw);
$raw=str_replace("script src=","script src=".$mydomain."javascriptfilter.php?jurl=",$raw);
//Or kill js files
//$raw=str_replace(".js",".off",$raw);
//Put in a base domain tag so images, flash and css are certain to work.
$replacethis="
";
$replacestring="
";
$raw=str_replace($replacethis,$replacestring,$raw);
//Echo the website html to the iframe.
echo $raw;
?>
javascriptfilter.php
//Get the raw html.
$jurl=trim($_GET["jurl"]);
$raw = file_get_contents($jurl);
//Note, if trickyness like decode detected then display empty.
if(!preg_match("decode(", $raw)){
//Kill anoying popups.
$raw=str_replace("alert(","isNull(",$raw);
$raw=str_replace("window.open","isNull",$raw);
$raw=str_replace("prompt(","isNull(",$raw);
$raw=str_replace("Confirm: (","isNull(",$raw);
//Echo the website html to the iframe.
echo $raw;
}
?>
php allow furl open,如何阻止來自iframe的彈出窗口?相关推荐
- 弹出窗口阻止程序干扰
弹出窗口阻止程序设置可能会阻止你完成特定的功能,如下载对象内容. 弹出窗口阻止程序设置 • Internet Explorer – 将 Windchill 服务器添加至本地 intranet 区域. ...
- 如何在Chrome中允许或阻止弹出窗口
Google Chrome does a great job at blocking pop-up windows out of the box, but sometimes it prevents ...
- java设置可信任站点_通过网页修改activex安全设置,添加信任站点,禁用弹出窗口阻止程序...
信任站点的注册表项 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Rang ...
- 通过注册表配置弹出窗口阻止程序
转自:http://hejianlong.123.blog.163.com/blog/static/2671583920098411142467/ 注册表位置:[HKEY_CURRENT_USER\S ...
- 禁用弹出窗口阻止程序
2019独角兽企业重金招聘Python工程师标准>>> 禁用弹出窗口阻止程序 方法一:通过浏览器设置 方法二:通过写注册表信息设置 具体代码如下: Windows Registry ...
- 如何编写弹出窗口不被IE阻止的程序
1. 在web编程过程中,经常会遇到一些页面需要弹出窗口,但是在服务器端用window.open弹出的窗口会被IE阻止掉, showModalDialog 弹出的窗口有时并不能满足我们需要,我们需要弹 ...
- window.open() 某些情况会被浏览器阻止弹出窗口
window.open() 的作用是创建一个新的浏览器窗口用来打开相关的资源,这是一个原生的 Javascript API 接口.有关 window.open() 的基本使用可以参考 mozilla ...
- window.open() 某些情况会被浏览器阻止弹出窗口及解决办法
window.open() 的作用是创建一个新的浏览器窗口用来打开相关的资源,这是一个原生的 Javascript API 接口. 有关 window.open() 的基本使用可以参考 mozilla ...
- html进网页自动弹出窗口,如何阻止网页中自动弹出的广告窗口?
首先我们来介绍一下通用的方法: 1.首先我们打开浏览器,选择[工具]--[Internet选项]如下图所示: 2.打开Internet选项窗口之后选择安全选项卡,在下面点击自定义级别进入安全设置 3. ...
最新文章
- 计算机专业英语chapter012,计算机专业英语 chapter_1.ppt
- PHP 实现一个可用的redis 事务锁, 解决并发问题
- Daily Scrum 9.28
- 精通python爬虫框架-精通Python爬虫框架Scrapy.pdf
- idea 用iterm 终端_帅气逼人的终端环境
- CodeForces 7D	 Palindrome Degree 字符串hash
- 现代软件工程 第八章 【需求分析】练习与讨论
- 【学习笔记】GIT使用
- j计算机一级考试题,2017全国计算机一级考试试题与答案
- java 输入任何字符继续_Thinking in Java 4th chap13笔记-字符串
- Docker配置国内加速器加速镜像下载的方法
- c++ extern学习
- 逆向工程之-数值原码和补码
- oeasy教您玩转vim - 28 - 水平移动
- 金仓数据库KingbaseES之WITH ORDINALITY
- idea 关闭检查更新_intellij idea怎么关闭自动更新
- python语句print(0xa+0xb)_Python语句print(0xA+0xB)的输出结果为()
- git branch 命令详解
- 小学数学测试软件报告,小学数学学业水平测试分析报告.doc.doc
- inet_addr源代码