Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Dreamweaver

This chapter is from the book


Because framesets are comprised of separate pages, it's entirely possible for a user to browse directly to a page—from a search engine, for example—and have no idea it's supposed to be part of a frameset. One way to handle this problem is to put this code in the <head> of every file in the frameset:

<script language="JavaScript">
if (top == self) self.location.href = "FramesetFileName";

In this code, FramesetFileName is the name of the frameset the file is part of. This code looks to see whether the page is within a frameset and if not, puts it in its intended place. Notice that this code is triggered only if the page is not in a frameset; it doesn't determine whether or not it is in the correct frameset.

  • + Share This
  • 🔖 Save To Your Account