Redirecting out of an iFrame

Want a neat little trick to redirect a page out of an iFrame when your session in the frame has finished?

Drop this into the header of your final page:

<script type=”text/javascript” language=”javascript”>
if (top.frames.length>0)
setTimeout(“top.location = window.location;”,100);
</script>

I’m unsure how this works when the person browsing has JavaScript turned off, I will still have to test that. If you have any ideas how to over come that please comment below.

Categories: blog.