如何防止自己的網站被別人以 iframe 蓋台嵌入 (iframe​反制辦法)

如何防止自己的網站被別人以 iframe 蓋台嵌入 (iframe​反制辦法)

如何防止自己的網站被別人以 iframe 蓋台嵌入 (iframe反制辦法)


資料來源: http://www.vixual.net/blog/archives/36

方法01:

<script type="text/javascript">
if( top.location != document.location ){
 top.location.href = document.location.href;
}
</script>

方法02:

<script type="text/javascript">
if( top.location != document.location ){
 document.write("<h1 style='color:#FF0000'>未經授權嵌入別人的網頁是可恥的行為!!</h1>(<a href='"+document.location+"' target='_blank'>原站網址</a>)");
}
</script>

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *