The Web Design Group presents:


Guide to frames usage



Frames design guidelines: automatic no-frames content

An important aspect of any site using frames is to make sure the site can still be used when the visitor has frames support disabled or uses a browser that does not support them at all. The NOFRAMES element is used for this purpose.

Problem: duplicating content

Usually, a site using frames will still have several "ordinary" HTML documents. These are loaded in the frames, as set up by the initial frameset document. But this initial document must have alternative content, otherwise nothing in the site is accessible for people who do not see the frames. A simple approach is to cut&paste the "starting" document into the noframes section of the frameset document. The disadvantage is obvious: you now have to update two documents.

Solution: server-side includes (SSI) or preprocessing

If your server supports server-side includes, you can use those to include the text into both the frame document and the noframes section of the initial document. Additionally, you can include the table of contents or links frame in the same way, so no navigational information is lost.

Imagine a site that has a table of contents and several text documents. The table of contents is found in "toc.html", and the starting document is "a.html". To properly use server-side includes in the manner described above, the text of these documents has to be put in a different document, so it can be included in multiple places. Let's assume this is done by putting them in "toc.txt" and "a.txt" respectively. The various documents that use these then look like this:

index.html - main index for the site

<FRAMESET COLS="30%,*">
<FRAME SRC="toc.html" NAME=toc>
<FRAME SRC="a.html" NAME=content>
<NOFRAMES>
<!--#include-file "a.txt"-->
<!--#include-file "toc.txt-->
</NOFRAMES>
</FRAMESET>

a.html - content document

<HEAD>
<TITLE>Title of document</TITLE>
<!-- other header stuff -->
</HEAD>
<BODY>
<!--#include-file "a.txt"-->
</BODY>

toc.html - table of contents

<BODY>
<!--#include-file "toc.txt"-->
</BODY>

Note that the content documents have a HEAD section, but the table of contents does not. This is done because the table of contents is never loaded as a standalone document. You can get fancy with tables to get the original column-based layout.

The syntax for server-side includes depends on the server. Check your server's documentation for the correct syntax if the above does not work.

This approach requires that server-side includes are used for each document that can be used this way.


Web Design Group
Last modified: 27 Apr 1997.
Feedback: galactus@htmlhelp.com
Copyright © 1996 - 2006. Arnoud "Galactus" Engelfriet. All rights reserved.