Return to the HTML Tips
Break Out of Frames
Note: In code examples I add a period after each left arrow bracket so the code can be viewed in all email programs. If you copy and paste, be sure to remove the periods or it won't work. Sometimes people that link to you will load your site within their frames. It may be intentional or it could be they didn't know how to link properly to release their own frames. This first part of the tip is a little JavaScript that, when added to the HEAD section of your page, will cause your page to re- load itself if it's trapped in someone else's frames. <.script type="text/javascript"> if (self ! = top) { top.location.href = self.location.href } <./script> That's all there is to it. With that in the HEAD section of your page, your site won't be trapped again. By adding a target attribute and value to your own links, you can have offsite links or your own pages break out of frames. Just add the target attribute and value to your links as shown: <.a href="http://www.boogiejack.com/" target="_top">Boogie Jack<./a> Be sure to add the underscore ( _ ) before the word top. If you're linking to your own pages you need not use the full URL (with the http://www part), you only need to include the relative path to your page, such as: <.a href="PageName.html" target="_top">Your Page<./a> From: THE INTERNET TUTOR Thursday, October 24, 2002 by Boogie Jack To SUBSCRIBE visit: http://www.shagmail.com/sub/sub-tutor.html
[report a broken link by clicking here]