当前位置: 代码迷 >> JavaScript >> 怎么过滤iframe里面的某个script
  详细解决方案

怎么过滤iframe里面的某个script

热度:128   发布时间:2012-03-04 11:13:33.0
如何过滤iframe里面的某个script,在线等
在做一个搜索的东西,页面用iframe插入了Baidu的搜索结果

但   Baidu页面有这么一行代码:   if   (top.location   !=   self.location)   {top.location=self.location;}

只要点搜索后,网页就自动跳转啦........

怎么过滤这行代码?

或者如何禁止   子Iframe里面的Script?

------解决方案--------------------
look
----------------------------------------------
<script type= "text/javascript ">
var location=undefine;
</script>
<Iframe src= "http://www.baidu.com "> </iframe>
------解决方案--------------------
直接重新定义location
<script>
var loction;
</script>
------解决方案--------------------
frames[0].onerror = function(){return true;}
把iframe的onerror事件覆盖。
------解决方案--------------------
除非你用XMLHTTP将它的内容取来再自己将不要的东西去掉再显示!
  相关解决方案