Software Sue

Link to Simply Sue
Link to Sustainability Sue
location: software/markup/html/frames/keep Skip navigation : Home  

Keeping your Frames


Note. These pages have not been upgraded from HTML to XHTML

Links to subsidiary frames

When someone has created a link to one of your subordinate frames, you may want to ensure that they load it within the parent frame, rather than frameless. To do this, insert the following code just before the </head> tag in each of your frames pages, where topFrame.htm is your main frames page:

<script language="JavaScript">
<!--Hide from older browsers, ensure top frame loaded
if (window == top) top.location.href = "topFrame.htm";
// -->
</script>

Keeping your pages out of others' frames

On the other hand, to make sure that when someone links to your pages, your pages do not appear within their frames, use the following JavaScript just before the tag:

<script language="JavaScript">
<!--Hide from older browsers, make your page top
if (top.location != location) top.location.href = location.href;
// -->
</script>

Needless to say, don't include this code within your subordinate frame pages, only the top frame.