1. 程式人生 > >防止網頁被嵌套

防止網頁被嵌套

location href host 嵌套 catch top 網頁 防止 try

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;

}

防止網頁被嵌套