如何防止他人在iframe中嵌入我的网页?
可能是重复问题:
如何防止我的网站页面被第三方网站的iFrame加载
如何防止他人在iframe中嵌入我的网页?
可能是重复问题:
如何防止我的网站页面被第三方网站的iFrame加载
另一种解决方案:
if (window.top !== window.self) window.top.location.replace(window.self.location.href);
使用Javascript:
if(window.top==window){
// not in iframe/frame
} else {
if(parent.parent.someFunction){
parent.parent.someFunction();
} else {
alert("parent.parent.someFunction() not defined.")
}
}