码迷,mamicode.com
首页 > Web开发 > 详细

防止网页被嵌入框架的代码

时间:2017-09-13 13:12:55      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:href   win   ati   嵌入   hostname   name   框架   防止   top   

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;

}

防止网页被嵌入框架的代码

标签:href   win   ati   嵌入   hostname   name   框架   防止   top   

原文地址:http://www.cnblogs.com/zhoudawei/p/7514077.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!