本文介紹了防止 iframe 竊取的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我認為有人在使用 iframe 竊取我的內容.我的網站是一個論壇,一個用戶剛剛向我舉報.
I think someone is stealing my content using an iframe. My website is a forum and a user has just reported them to me.
如果其他人這樣做,我如何以編程方式(php、JavaScript、jQuery、HTML)找到他們的網站?
How can I find their website programmatically (php,JavaScript,jQuery,HTML) if their are others doing this?
互聯網上允許他們這樣做嗎?我可以采取行動嗎?
Is this allowed on the internet for them to do this and can I take action?
推薦答案
使用 JavaScript 你可以做到
With JavaScript you can do
if(window.top==window){
//not inside iframe
} else {
if(parent.parent.someFunction){
parent.parent.someFunction();
} else {
alert("framing is not allowed")
}
}
或
if (window.top !== window.self) window.top.location.replace(window.self.location.href);
一些現代瀏覽器也支持 X-FRAME-OPTIONS 標頭,它可以有兩個值:
Some modern browsers also support the X-FRAME-OPTIONS header, that can have two values:
* DENY – prevents the page from being rendered if it is contained in a frame
* SAMEORIGIN – same as above, unless the page belongs to the same domain as the top-level frameset holder.
支持標題的瀏覽器:
* IE8 and IE9
* Opera 10.50
* Safari 4
* Chrome 4.1.249.1042
* Firefox with NoScript
這篇關于防止 iframe 竊取的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!