Tutorial 15: You've been Framed, Part II - HTML with Style | 6
One trick often used by Web authors the world over is having more than one frameset when usually one would suffice. For instance, take the example above with the large document that contains sections and sub-sections; the frameset could be altered to something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd"> <HTML> <HEAD><TITLE>M.O.R.O.N.S. White Paper</TITLE></HEAD> <FRAMESET ROWS="20%,*"> <FRAME NAME="toc" SRC="toc.html"> <FRAME NAME="subsection" SRC="sub1.html"> </FRAMESET> </HTML>
Now you've got the short table of contents along the top, and a document called sub1.html beneath that. You can make this document a frameset that contains the other two frames needed for our layout, as they should appear for section 1. Following the links in the top frame will take viewers to the frames that corresponds to the section they selected by loading a new frameset.
This approach solves the problem of changing the contents of more than one frame at a time, and also partially solves the linking problem as you can now link to a specific section in your document (but you still can't link to a sepcific sub-section, or a fragment of a sub-section). Search engines will still erroneously link to pages on your site, and most browsers will still bookmark only the initial state of the frameset. Also, note that you've added even more documents to download since every time a user loads a new section he has to load three new documents.
Refining the above method a bit, you can have each and every document on your site to be a unique frameset, and always use the _top target to load the frameset anew when a viewer follows a link. Now you can change as many frames as you want at a time, and you can link to any page in your document, and have users bookmark it correctly. Using a BASE element can also diminish the chance of accidentally trapping the user in your frameset.
On the down side, you've just added a considerable size overhead to your pages, as users have to download a frameset and at least one (but usually more) frames every time they follow a link. Search engines will still get it all wrong, and you still can't use fragment identifiers for links.
Produced by Stephanos Piperoglou
Created: May 28, 1998
Revised: February 25, 1999