Forum Moderators: open

Message Too Old, No Replies

Preventing iframes

How do I stop someone putting my site in an iframe

         

Numpty

1:30 pm on Jan 25, 2006 (gmt 0)

10+ Year Member



One of our affiliates is putting our website inside an iframe. This affects the functionality of the site, so I'd like to find a way to redirect the browser to a non-iframed version of the site.

Does anyone know how I can do this? There seems to be little information available on the web

mattglet

4:23 pm on Jan 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Put this javascript in your page:

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

Add this onLoad attribute to your Body element:
<body onload="unFrame()">

If you are using frames on your own site, you may run into problems with this, otherwise you will be fine.