[Home]Get out of a frameset

HomePage | RecentChanges | Preferences | Newbie Help

How do I get out of a frameset?

http://www.htmlhelp.com/faq/html/all.html#frame-getout


Comments --

If you want to break out of frames use this (frame-buster script) in the head section of your page:

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

 Jan Derk
 Digital Dutch

 -- Arles Image Web Page Creator
 -- http://www.digitaldutch.com/arles/

Actually, that would create a "trap" for people that want to back out of the site using their browser's back button (and who do not know about the drop-down history that is built into the back button). The best script to use would be:

<script type="text/javascript">
if(parent.frames.length!=0) {
  window.top.location.replace("thisfile.html") }
else {}
</script>
With the location.replace string, you *replace* the frameset with the new page, allowing the user to back out of that page without getting stuck. And if you want the page to reference itself, you can use the =document.location.href string that you used in your example (it _should_ work...) instead of the ("thisfile.html")

Hope this helps.

-- "Geshel" on Thu, 05 Apr 2001 06:56:08 GMT, on alt.html


HomePage | RecentChanges | Preferences | Newbie Help
This page is read-only | View other revisions
Last edited October 21, 2001 6:26 pm (diff)
Search:

This FAQ is happily hosted by Betadome Digital Media