转载 来源于 http://www.ruanyifeng.com/blog/2008/10/anti-frameset_javascript_codes.html 一个博客大大写的
<script type="text/javascript">
if (window!=top) // 判断当前的window对象是否是top对象
top.location.href =window.location.href; // 如果不是,将top对象的网址自动导向被嵌入网页的网址
</script>
升级版防止别人偷取页面而自己不能使用的代码
try{
top.location.hostname;
if (top.location.hostname != window.location.hostname) {
top.location.href =window.location.href;
}
}
catch(e){
top.location.href = window.location.href;
}