我需要保护我的网站从框架.在同一时间,我需要iframe我自己的网站和一些允许的网站.我怎么能这么做呢?


I need to protect my website from iframe. In the same times, i need to iframe by my own sites and some permitted website. How can i do this?

我需要保护我的网站从iframe。同时,我需要通过我自己的网站和一些允许的网站来框架。我该怎么做呢?

除非我允许,否则任何网站都不能使用iframe。我认为通过javascript可以证明这是可能的。

查看此链接实现代码查看-来源:http://onlinefreetv.net/test.php/

通过上面的代码,我可以防止任何iframe,但是这个系统没有设施允许我自己的站点或被允许的站点执行iframe。

我希望我能描述的一切得到实际的帮助。由于

我相信这就是你要找的。

if (top.location !== self.location){
    top.location = self.document.location;
}

你最好在你的中试试这些配置指令。Htaccess 隐藏文件,如果它可以工作:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !yoursite'.com$
RewriteRule . /abuse.txt [L]

并在文件管理器中创建一个/abuse.txt文件,其中包含您想要的滥用语句,例如任何警告或警告。但请确保您的虚拟主机帐户有Apache HTTP服务器mod_rewrite .

相关文章: