The Internet Connection

By Michael Sauers

One for Web Developers
I have read many articles lately about problems frames can cause web-site users. I am not going to argue that frames-based web sites are all bad (I have one myself), but neither am I here to praise them. Frames-based web sites can work only when created properly. However, many new web developers make similar common mistakes.

One of the most confusing problems is the framing of third-party content, presenting someone else's web page as though it were yours. Some web developers make it clear this material originated elsewhere, but some don't. Some web developers create this perception intentionally, some by mistake. Any way you look at it, the user can easily become confused, and lawsuits can and have resulted.

Two solutions are available. If you are the designer of a frames-based site be sure to use the target="_top" attribute on any link that goes to a page that isn't part of your site. By doing so, you ensure that the following page is loaded into the full browser window and not into one of the frames on your web site.

If you are the designer of a web site in which you want to be confident that your pages don't show up in someone else's frame, add the following few lines of javascript within the coding of your pages:

<script language="javascript">
   <! --
   if (top.frames.length!=0)
   top.location=self.document.location;
   //-- >
</script>

When a frames-based site attempts to load your page into one of its frames, this script will override that command and display your page in the full browser window. (This will not work, however, if the user's browser doesn't support javascript, or if the user has disabled javascript.)