Are you being FRAMED?

By Peter Bromberg

One of the most annoying things websites do to display a page from your site in a frame. Here's an easy way to fix it.

One of the most annoying things websites do to display a page from your site in a frame. Here's an easy way to fix it.


Google Images, besides other lesser-known offenders, displays your site in a frame. Here’s some JavaScript to get rid of the frame and reload the page to its proper URL:

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

Here, "self" refers to the current window; "top" is a reference to the top-level window which should contains the current window in a "frameless" setting. Otherwise, somebody is framing you. If you feel like an evangelist, you could feel free to replace location.href with a URL to some page which extolls the virtues of being a good netizen.

Popularity  (177 Views)