The Wayback Machine - https://web.archive.org/web/20090602091829/http://www.webreference.com:80/html/tutorial15/5.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / html / tutorials / 15 / 5

index123456

Tutorial 15: You've been Framed, Part II

Developer News
Rails 3 Gets Supersized With Merb
SpringSource, Hyperic Merge for App Management
Get Ready for Windows 7 'Release Candidate'

The nested frameset trick

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.

The multiple frameset trick

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.

Using Client-Side Scripting

A number of people will tell you that you can use client-side methods such as JavaScript to correct the various problems with frames by havign scripts that do things such as load new pages in frames and various other neat tricks. However, you need to remember a couple of things about scripting. Using scripts as an integral part of your Web site's functionality is a very bad idea. Scripting languages are very unstable, poorly implemented things and have huge incompatibilities between browsers. Many browsers do not support any scripting whatsoever, and many users elect to disable scripting for reasons of security or performance. Scripts are nice if you want to add special effects to spice up a page, but you should avoid using them for anything that is integral to your page; in other words, your site should work properly without the scripts.

index123456

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info
Copyright 2009 WebMediaBrands Inc. All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Debugging JavaScript: Beyond Alerts · Getting Started with URL Rewriting with Apache · Kicking the Tires on Your Next CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Experiencing the Totally Connected Lifestyle · Review: Asus Eee PC 1000HE · Intel to Host Live Nehalem Q&A;

URL: http://www.webreference.com/html/tutorial15/5.html

Produced by Stephanos Piperoglou
Created: May 28, 1998
Revised: February 25, 1999

Morty Proxy This is a proxified and sanitized view of the page, visit original site.