刚从Zola's BLOG上看到的一个较简单的防止Bolaa、Chinabbs框他人页面的方法。
var web = document.location;
if (top.location != self.location) {
alert("你现在访问的是"+web+"\n 检测到你使用框架浏览本站内容,本页即将跳转到创作共用约定页面。\n 请不要使用框架跨站调用本站内容。\n 请遵守Creative Commons协议。\n duduwolf's BLOG授权方式为:署名 · 非商业用途 · 保持一致");
this.location="http://www.creativecommons.cn/licenses/by-nc-sa/1.0/";
}
if (top.location != self.location) {
alert("你现在访问的是"+web+"\n 检测到你使用框架浏览本站内容,本页即将跳转到创作共用约定页面。\n 请不要使用框架跨站调用本站内容。\n 请遵守Creative Commons协议。\n duduwolf's BLOG授权方式为:署名 · 非商业用途 · 保持一致");
this.location="http://www.creativecommons.cn/licenses/by-nc-sa/1.0/";
}
把上面的这段代码加入到你的公共js文件中就OK了。这里有一个实际效果
方法不错,很简单,自己以前咋就没想到呢!我给自己的blog已经加上了。