Breaking out of Frames
While it doesn't seem to happen to myself as much as it used to, getting stuck in frames can be rather frustrating particularly if you are unable to do much about it. Even if your site is not using frames, it can easily become trapped in some other careless site owner's frame set - and unless you take the precautions to free your site as quickly as possible, it could very well get lost in the clutter.
Breaking out of frames is not particularly difficult, but more often than not it requires some sort of action on the part of the visitor. It is always a good idea to have a well placed and correctly targeted "frame busting" link at all the major points of entry to your web site, that way your visitors can choose to break out of a frame set belonging to another site as soon as possible.
To create a break out of frames link, you simply link back to the page you want to open and make sure that the target attribute for the link is set to _top. The resulting link will then open up in the same window. Here is an example of a link that will break a page (in this case index.html) out of the frame set, if any, it is stuck in.
<a href=index.html target=_top>break out of frames</a>
The page you link to is usually the same page as the one you create the link on. If however you are using a frame set, you should use a link to a page containing a frame set instead - otherwise you will run the risk of reloading your page without its navigational elements.
Automatic Frame Buster
It is also possible for your page to break out of frames automatically. A small snippet of JavaScript is all that it takes to check that the page has loaded in the main frame of the window, and if not, reload it. Of course, the downside to this is that your visitors need to have JavaScript enabled for it to work, so you might want to have a frame buster link as backup.
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Hide from old Browsers
if (top != self) top.location.href = location.href;
// Stop hiding from old browsers -->
</SCRIPT>
The code above should be placed in the <head> tags of the page you want to keep out of frames. Surprisingly this script can be made to work on a framed page without breaking your own frame set. All you need to do to use it with framed pages is to put it in the page that contains your frame set. Care has to be taken however that it is not used in the pages that are seen by your visitors, doing so will make your content pages break free of your frame set which will undoubtedly lead to navigational problems.
