开发者

How to prevent embedding my web page inside an iframe? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How to prevent my site page to be loaded via 3rd party site frame of iFrame

How can I preven开发者_JS百科t others from embedding my web page inside an iframe?


Another solution:

if (window.top !== window.self) window.top.location.replace(window.self.location.href);


With Javascript:

if(window.top==window){
    // not in iframe/frame
} else {
    if(parent.parent.someFunction){
       parent.parent.someFunction();
    } else {
       alert("parent.parent.someFunction() not defined.")
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜