仿冒网站风险解决方案:防止自己的网页被别人iframe嵌入

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;
}

在页面中加入以上JS代码.

参考地址:http://www.ruanyifeng.com/blog/2010/08/anti-frameset_javascript_codes_continued.html

猜你喜欢

转载自blog.csdn.net/qq_32915337/article/details/79128568