Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q473 Is it possible for a script to check for frames and if present, get rid of them?

irt.org | Knowledge Base | JavaScript | Frame | Q473 [ previous next ]

Q473 Is it possible for a script to check for frames and if present, get rid of them?

You can use the following which checks if the current document is framed:

<script language="JavaScript"><!--
if (parent != self)
    top.location.href = location.href;
//--></script>

or the following which checks if the current document contains frames:

<script language="JavaScript"><!--
if (window.frames.length > 0)
    top.location.href = 'apage.htm';
//--></script>

Feedback on 'Q473 Is it possible for a script to check for frames and if present, get rid of them?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.