BREAKING FREE OF FRAMES

 

High Traffic AD spot for rent

Free Ad Quote

Live help

1 204 344 5070

A lot of sites use frames to structure their information display. The trouble is, sometimes these sites will exit to other sites and trap them within their frames. If you want to make sure your visitors are able to break free of other site frames on entry, you can code a simple script to exit the trap and re-load your site, frame-free.

Here's how it's done. You code a small JavaScript in the HEAD Section of your page. This script checks to see if your page resides in a Frame, and if so, targets a refresh of the page to a non-framed environment. Simple and effective. Here's the script:

<SCRIPT Language="JavaScript">
if (top.frames.length!=0)
top.location=self.document.location;
</SCRIPT>

If you want, you can also give your visitors the option to break free by simply targeting an HREF to the current page with the "_top"
target parameter.

<A HREF="Current_Page.html" TARGET="_top">
GET ME OUT OF THESE FRAMES</A>

When your visitors click this link, they will come back to the same page, but no longer will your page be displayed within the referring site's
frames.

NOTE: If you are using Frames for your Web site and you are linking to other sites, you should be sure that you are not trapping those sites in your frames, unless this is your intention (as with AskJeeves, for example). This is a simple matter of targeting your links outside of frames. An easy method to do this is to choose this target in your A HREF statement:

A HREF="http://www.linked_site.com" TARGET="_blank"

This statement will launch a new browser window for the linked URL. This is handy to know as it will retain your site as a stand-alone window. If you don't want that, you can choose this parameter: TARGET="_top"