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

HTML: The Definitive Guide

Previous Chapter 7
Links and Webs
Next
 

7.8 Supporting Document Automation

There are two additional header tags whose primary function is to support document automation, interacting with the Web server itself and document-generation tools.

The <meta> Header Element

Given the rich set of HTML header tags for defining a document and its relationship with others that go unused by most HTML authors, you'd think we'd all be satisfied.

But, no. There's always someone with special needs. They want to be able to give even more information about their precious document, information that might be used by browsers, readers of the HTML source, or by document-indexing tools. The <meta> tag is for you who need to go beyond the beyond.

The <meta> tag belongs in the document header and has no content. Instead, attributes of the tag define name/value pairs that associate the document. In certain cases, these values are used by the web server serving the document to further define the document content type to the browser.

The name attribute

The name attribute supplies the name of the name/value pair defined by the <meta> tag. The HTML standard does not define any predefined <meta> names. In general, you are free to use any name that makes sense to you and other readers of your HTML source.

One common name used is keywords, which defines a set of keywords for the document. When encountered by any of the popular search engines on the Web, these keywords will be used to categorize the document. If you want your documents to be indexed by a search engine, consider putting this kind of tag in the <head> of each document:

<meta name="keywords" content="kumquats, cooking, peeling, eating">

If the name attribute is not provided, the name of the name/value pair is taken from the http-equiv attribute.

content

The content attribute

The content attribute provides the value of the name/value pair. It can be any valid string, enclosed in quotes, if necessary. It should always be specified in conjunction with either a name or http-equiv attribute.

As an example, you might place the author's name in a document with:

<meta name="Authors" content="Chuck Musciano & Bill Kennedy">

The http-equiv attribute

The http-equiv attribute supplies a name for the name/value pair and instructs the server to include the name/value pair in the MIME document header that is passed to the browser before sending the actual document.

When a server sends a document to a browser, it first sends a number of name/value pairs. While some servers might send a number of these pairs, all servers send at least one:

content-type: text/html

This tells the browser to expect to receive an HTML document.

When you use the <meta> tag with the http-equiv attribute, the server will add your name/value pairs to the content header it sends to the browser. For example, adding:

<meta http-equiv="charset" content="iso-8859-1">
<meta http-equiv="expires" content="31 Dec 99">

causes the header sent to the browser to contain:

content-type: text/html
charset: iso-8859-1
expires: 31 Dec 99

Of course, adding these additional header fields makes sense only if your browser accepts the fields and uses them in some appropriate manner.

The charset attribute

Internet Explorer provides explicit support for a charset attribute in the <meta> tag. Set the value of the attribute to the name of the character set to be used for the document. This is not the recommended way to define a document's character set. Rather, we recommend always using the http-equiv and content attributes to define the character set.

The <nextid> Header Element

This tag is not defined in the HTML 3.2 standard and should not be used. We describe it here for historical reasons.

The idea behind the <nextid> tag is to provide some way of automatically indexing fragment identifiers.

The n attribute

The n attribute specifies the name of the next generated fragment identifier. Although the HTML standard does not define the format of this name, it is typically an alphabetic string followed by a two-digit number. A typical <nextid> tag might look like this:

<html>
<head>
<nextid n=DOC54>
</head>
...

An automatic-document generator might use the nextid information, then, to successively name fragment identifiers DOC54, DOC55, and so forth within this document.


Previous Home Next
Establishing Document Relationships Book Index Formatted Lists

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell