【问题标题】:how to detect my site is in iframe and remove iframe?如何检测我的网站在 iframe 中并删除 iframe?
【发布时间】:2013-04-03 09:01:27
【问题描述】:

我想知道如何知道我的网站已嵌入 iFrame 并删除 iFrame 以像往常一样在地址栏中使用 url 加载我的网站!

就像这个:

<iframe src="http://varzesh3.com"></iframe>  

【问题讨论】:

标签: javascript jquery iframe


【解决方案1】:

通过评估selftop,然后使用replace() 打破框架,您可以很容易地实现这一点:

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

【讨论】:

    猜你喜欢
    • 2011-03-22
    • 2018-12-12
    • 1970-01-01
    • 2018-03-21
    • 2016-01-08
    • 2021-04-24
    • 2018-02-12
    • 2017-10-31
    • 1970-01-01
    相关资源
    最近更新 更多