HTML: The Definitive Guide

Previous Chapter 10 Next
 

10.5 The <noframes> Tag

A Netscape frame document has no <body>. In fact, it must not, since the browser will ignore any frame tags if it finds any <body> content before it encounters the first <frameset> tag. A frame document, therefore, is all but invisible to any non-frame capable browser. The <noframes> tag gives some relief to the frame disabled.

Use the <noframes> tag only within the outermost <frameset> tag of a frame document. The content inside the <noframes> tag and its required end tag (</noframes>) is not displayed by Netscape or other frame-capable browser, but is displayed in lieu of other contents in the frame document by browsers that do not handle frames. The contents of the <noframes> tag can be any normal HTML body content, including the <body> tag itself.

Although this tag is optional, experienced HTML authors typically include the <noframes> tag in their frame documents with content that warns a frame-incompatible browser user that they're missing the show. And smart authors will give those users a way out, if not direct access to the individual documents that make up the frame document contents. Remember our first frame example in this chapter? Figure 10-3 shows what happens when that frame document gets loaded into Mosaic:

Figure 10-3: A <noframes> message in a nonframe-capable browser

[Graphic: Figure 10-3]

<noframes>
  Sorry, this document can be viewed only with Netscape
  Navigator version 1.2 or later.
  <a href="frame1.html">Take this link</a>
  to the first HTML document in the set.
</noframes>

The reason <noframes> works is that most browsers are extremely tolerant of erroneous tags and incorrect documents. A nonframe browser simply ignores the frame tags. What's left, then, is the content of the <noframes> tag, which the browser dutifully displays.

If your browser strictly enforces some version of HTML that does not support frames, it may simply display an error message and refuse to display the document, even if it contains a <noframes> tag.


Previous Home Next
Frame Contents Book Index Named Frame or Window Targets