2013-04-03 61 views
0

我想知道,我怎麼能知道我的網站被嵌入iframe和刪除的iFrame載入我的網站像往常一樣網址的地址欄!如何檢測我的網站是在iframe並刪除iframe?

就像這樣:

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

的http://計算器.com/questions/6158903/iframe-is-if-content-in-iframe-is-submit – Pete

+0

解決方法是在本[問題] [1]本身 [1]:http://stackoverflow.com/questions/4527464/preventing-iframe-embedding-but-with-one-exception –

+0

http://stackoverflow.com/questions/8524449/google-homepage-will - 未負載功能於一個的iframe –

回答

1

您可以通過評估selftop,然後用replace()打出來的框架很容易實現這一點:

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