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的彈出窗口?相关推荐

  1. 弹出窗口阻止程序干扰

    弹出窗口阻止程序设置可能会阻止你完成特定的功能,如下载对象内容. 弹出窗口阻止程序设置 • Internet Explorer – 将 Windchill 服务器添加至本地 intranet 区域. ...

  2. 如何在Chrome中允许或阻止弹出窗口

    Google Chrome does a great job at blocking pop-up windows out of the box, but sometimes it prevents ...

  3. java设置可信任站点_通过网页修改activex安全设置,添加信任站点,禁用弹出窗口阻止程序...

    信任站点的注册表项 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Rang ...

  4. 通过注册表配置弹出窗口阻止程序

    转自:http://hejianlong.123.blog.163.com/blog/static/2671583920098411142467/ 注册表位置:[HKEY_CURRENT_USER\S ...

  5. 禁用弹出窗口阻止程序

    2019独角兽企业重金招聘Python工程师标准>>> 禁用弹出窗口阻止程序 方法一:通过浏览器设置 方法二:通过写注册表信息设置 具体代码如下: Windows Registry ...

  6. 如何编写弹出窗口不被IE阻止的程序

    1. 在web编程过程中,经常会遇到一些页面需要弹出窗口,但是在服务器端用window.open弹出的窗口会被IE阻止掉, showModalDialog 弹出的窗口有时并不能满足我们需要,我们需要弹 ...

  7. window.open() 某些情况会被浏览器阻止弹出窗口

    window.open() 的作用是创建一个新的浏览器窗口用来打开相关的资源,这是一个原生的 Javascript API 接口.有关 window.open() 的基本使用可以参考 mozilla ...

  8. window.open() 某些情况会被浏览器阻止弹出窗口及解决办法

    window.open() 的作用是创建一个新的浏览器窗口用来打开相关的资源,这是一个原生的 Javascript API 接口. 有关 window.open() 的基本使用可以参考 mozilla ...

  9. html进网页自动弹出窗口,如何阻止网页中自动弹出的广告窗口?

    首先我们来介绍一下通用的方法: 1.首先我们打开浏览器,选择[工具]--[Internet选项]如下图所示: 2.打开Internet选项窗口之后选择安全选项卡,在下面点击自定义级别进入安全设置 3. ...

最新文章

  1. 计算机专业英语chapter012,计算机专业英语 chapter_1.ppt
  2. PHP 实现一个可用的redis 事务锁, 解决并发问题
  3. Daily Scrum 9.28
  4. 精通python爬虫框架-精通Python爬虫框架Scrapy.pdf
  5. idea 用iterm 终端_帅气逼人的终端环境
  6. CodeForces 7D Palindrome Degree 字符串hash
  7. 现代软件工程 第八章 【需求分析】练习与讨论
  8. 【学习笔记】GIT使用
  9. j计算机一级考试题,2017全国计算机一级考试试题与答案
  10. java 输入任何字符继续_Thinking in Java 4th chap13笔记-字符串
  11. Docker配置国内加速器加速镜像下载的方法
  12. c++ extern学习
  13. 逆向工程之-数值原码和补码
  14. oeasy教您玩转vim - 28 - 水平移动
  15. 金仓数据库KingbaseES之WITH ORDINALITY
  16. idea 关闭检查更新_intellij idea怎么关闭自动更新
  17. python语句print(0xa+0xb)_Python语句print(0xA+0xB)的输出结果为()
  18. git branch 命令详解
  19. 小学数学测试软件报告,小学数学学业水平测试分析报告.doc.doc
  20. inet_addr源代码

热门文章

  1. joyful pandas 05 变形
  2. vivo图像算法工程师双非研究生可以吗_我的自动驾驶工程师成长之路
  3. 5种主流周界安防检测技术,EasyCVR智能检测视频平台可以实现哪些应用?
  4. spi通信的理解(NSS,SSI,SSM位,贼恶心)
  5. 单片机DA转换实验c语言编程,单片机DA转换实验报告
  6. SqlServer查询重复数据
  7. 小蜜蜂java小游戏_Java api
  8. 我的HIFI WAV播放器设计之一
  9. 《被讨厌的勇气》书摘心得之我们的不幸是谁的错?(3)
  10. 人力资源管理的六大模块