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

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;

}

转载于:https://www.cnblogs.com/zhoudawei/p/7514077.html