HOME       >>       Programming

Are You Being Framed?


Does your site have good original content such as maps, photos, tutorials, or widgets? Have you noticed that your number of hits, and bandwidth usage has gone up, but your sales haven't? Check your server logs. If many hits are coming from a single URL for no apparent reason, maybe you should pay a visit to that URL. There's an excellent chance that you will find your content being displayed somewhere on that page. By using iframes or regular frames, another site can actually put your page on their site. By using tricks such as z-index, and CSS positioning they can even display only one part of your page, the content they are stealing.

When another site displays your page or content on their site, it costs you bandwidth. It is a visit to your site from which you get nothing. It may not be regarded legally as stealing where you are, but it is definitely unethical. Fortunately, it is extremely easy to prevent. All you have to do is put this code snippet in the head tags of each page you don't want to be framed:

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

This will turn the tables on the would-be framer, because now the page being framed will open as the top level window, and their visitor will be on your site! You will have turned a drain on your bandwidth into a great source of visitors at the thieving site's expense!


Won't work against the method that I use to get info from a different site, using PHP to extract the source and then removing everything except what I need.


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.