How to block showing your site in IFrame (Anti-iframe)
October 30, 2012 · Posted in Development
Recently, I found that one of my popular sites is shown as part of other site. So visitors of that not-mine site, being on that site, can access all the services of my sites. They used my site content and services via iframe and took benefits from my site.
Below is the solution how to prevent this, i.e. block showing your site content via iframe. The solution is pretty simple.
Put this javascript code on all your pages:
<script>if(self != top) { top.location = self.location; }</script>If one site will show your site in iframe, it will redirect the browser to your site directlty, so that user will will your site in browser as it is.
Comments
-
Ok



