start page | rating of books | rating of authors | reviews | copyrights

Book HomeHTML & XHTML: The Definitive GuideSearch this book

11.5. The <noframes> Tag

A frame document has no <body>. 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.

<noframes>

Function:

Supply content for non-frame-capable browsers

Attributes:

CLASS

ONKEYUP

DIR

ONMOUSEDOWN

ID

ONMOUSEMOVE

LANG

ONMOUSEOUT

ONCLICK

ONMOUSEOVER

ONDBLCLICK

ONMOUSEUP

ONKEYDOWN

STYLE

ONKEYPRESS

TITLE

End tag:

</noframes>; sometimes omitted in HTML

Contains:

body_content

Used in:

frameset_content

You should 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 any 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 body content, including the <body> tag itself.

Although this tag is optional, experienced authors typically include the <noframes> tag in their frame documents with content that warns a non-frame-capable 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 11-6 shows what happens when that frame document gets loaded into an old version of Mosaic.

Figure 11-6

Figure 11-6. A <noframes> message in a non-frame-capable browser

<noframes>
  Sorry, this document can be viewed only with a
  frame-capable browser. Go to the <a href="frame1.html">
 first HTML document</a> 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 or XHTML 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.

11.5.1. <noframes> Attributes

There are no attributes specific to the <noframes> tag, but you can use any of the sixteen standard attributes: class and style for style management, lang and dir for language type and display direction, title and id for titling and naming the enclosed content, and any of the event attributes for user-activated JavaScript processing within the <noframes> tag.

[See also: Section 3.6.1.1, "The dir attribute" Section 3.6.1.2, "The lang attribute" Section 4.1.1.4, "The id attribute" Section 4.1.1.5, "The title attribute" Section 8.1.1, "Inline Styles: The style Attribute" Section 8.3, "Style Classes" Section 12.3.3, "JavaScript Event Handlers"]



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.