How to prevent my site page from being loaded into other website iframe?

后端 未结 3 1679
甜味超标
甜味超标 2021-02-06 14:44

We have many gaming websites, among them I am hosting exclusive games on my server, and i don\'t want to access my games to other websites from my server. I want to restrict the

3条回答
  •  星月不相逢
    2021-02-06 15:03

    Doing this via JavaScript is limited in how it will restrict the content to the browser level. You might be better off Apache mod_rewrite to more effectively block content on a server level as explained here.

    For example, this code you could place in an .htaccess file if your server supports it. I am using www.abc.com as an example & matching swf & fla files as an example:

    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?abc.com/.*$ [NC]
    RewriteRule ^.*\.(swf|fla)$ - [F] 
    

提交回复
热议问题