开发者

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

开发者 https://www.devze.com 2023-01-08 01:53 出处:网络
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
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

精彩评论

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