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

ie firefox chrome 谷歌浏览器测试正常

 

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;

}

  

posted @ 2019-06-21 09:16  码狼先生  阅读(69)  评论(0编辑  收藏  举报