如何阻止我的网站被他人诬陷? [英] How to stop my website being framed by others?
问题描述
如何阻止我的网站加载到框架中?
How can I stop my website from loading in a frame?
从这里可以看出:
http://yehg.net/lab/pr0js/pentest/cross_site_framing.php
Google.com将无法加载,msn。 com将突破框架。 AOL.com将加载罚款。如何使我的网站突破框架或加载整个窗口?
Google.com won't load, msn.com will break out of the frame. AOL.com will load fine. How do I make my website either break out of the frame or load in the whole window?
推荐答案
这个小脚本片段应该可以工作:
This little script snippet should work:
<script>
if (window !== top) top.location = window.location;
</script>
此外,您可以通过指定 X-Frame-Options:DENY
标题。请参见 https://developer.mozilla.org/en-US/docs/ The_X-FRAME-OPTIONS_response_header 了解详情。
Also, you can prevent your pages from being loaded in an iframe by specifying a X-Frame-Options: DENY
header. See https://developer.mozilla.org/en-US/docs/The_X-FRAME-OPTIONS_response_header for details.
这篇关于如何阻止我的网站被他人诬陷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!