首页 > 代码库 > 防止网页被嵌套

防止网页被嵌套

try{

  top.location.hostname;

  if (top.location.hostname != window.location.hostname) {

    top.location.href =http://www.mamicode.com/window.location.href;

  }

}

catch(e){

  top.location.href = http://www.mamicode.com/window.location.href;

}

防止网页被嵌套