[英]how to detect my site is in iframe and remove iframe?
I want to know that how can I know that my website is embedded in iFrame and remove iFrame to load my site as usual with url in address bar! 我想知道如何知道我的网站已嵌入iFrame并删除iFrame以照常使用地址栏中的网址加载我的网站!
just like this one: 就像这样一个:
<iframe src="http://varzesh3.com"></iframe>
You can achieve this quite easily by evaluating self
and top
, and then using replace()
to break out of the frame: 您可以通过评估
self
和top
,然后使用replace()
突破框架,轻松实现此目标:
if (self !== top)
top.location.replace(self.location.href)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.