日期:2014-05-16  浏览次数:20469 次

如何过滤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将它的内容取来再自己将不要的东西去掉再显示!