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

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 @ 2017-09-13 11:33  前端开发-周先生  阅读(302)  评论(0编辑  收藏  举报