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

再开一贴,高手进
之前开了一贴列的一个方案没结果:http://bbs.csdn.net/topics/390667225
现在重新讨论新方案:
自己的网站Http://www.SiteA.com/Index.html
这个Index.html的页面如下所示,通过iframe打开别人的网站。

<html>
<head>
<title>自己的网站页面</title>
</head>
<body>
      <iframe id="mainFrame" name="mainFrame" scrolling="yes" height="700px" width="100%" src="http://www.SiteB.com/Play.html" frameborder="0" scrolling="auto" />

</body>
</html>


=================================
辩论方B(SiteB网站开发者):我要如何用脚本防止别人比如(SiteA这个不厚道的人用iframe裹了我的网页进行盗用?)
辩论方A(SiteA网站开发者):我如何突破我要盗用方的防盗用脚本措施
{
  附注:常见的限制别人iframe自己网站的,好像经常看到top.location!=self.location
或判断 窗口标题等等。。高手们谈谈怎么突破。。
}

------解决方案--------------------
你是要防盗还是要破解防盗啊?
------解决方案--------------------
只要加了防iframe的基本没法突破,IE8-可以定义location对象来实现,
------解决方案--------------------
破不了
而且作为开发者 还是更希望被保护吧
------解决方案--------------------
1.破top.location != self.location: Html5的沙盒iframe可以禁止iframe内部将iframe外部的location navigate到其他URL上,参见iframe的sandbox属性。

2.破沙盒iframe限制,检测是否被沙盒了:
if(top.location != self.location) {
  try{
    top.location = self.location;
  }catch(e){
    alert("请确定浏览器地址栏的网址是"+self.location+",以免您的信息被盗。");
  }
}