A Complete Guide to Web Design

(やまだぃちぅ) #1
Using <meta> Tags 99

Structural
Tags

Using <meta> Tags

Web Design in a Nutshell, eMatter Edition

Client-pull uses therefreshattribute value, first introduced by Netscape. It tells
the browser to wait a specified number of seconds (indicated by an integer in the
content attribute) and then load a new page. If no page is specified, the browser
will just reload the current page. The following example instructs the browser to
reload the page after 15 seconds (we can assume there’s something fancy
happening on the server side that puts updated information in the HTML
document):


<META HTTP-EQUIV="refresh" CONTENT="15">

To reload a different file, provide the URL for the document within the content
attribute as shown below:


<META HTTP-EQUIV="refresh" CONTENT="1; URL=http://nextdocument.
html">

Note that there is only a single set of quotation marks around the value for
content. Although URLs usually require their own quotation marks, these are
omitted within the context of the content attribute.


To create a slide-show effect, add ameta refreshtag in theof each
document that points to the next HTML document in the sequence. You can set
the time interval to as many seconds as you like; setting it to 0 will trigger the next
page as soon as the current page has downloaded. Bear in mind, however, the
actual amount of time the page takes to refresh is dependent on complex factors
of file size, server speed, and general web traffic.


In the following example, three files are coded to loop endlessly at five-second
intervals:


Document1.html contains:


<META HTTP-EQUIV="refresh" CONTENT="5; URL=2.html">

Document2.html contains:


<META HTTP-EQUIV="refresh" CONTENT="5; URL=3.html">

Document 3.html contains a tag which points back to1.html:


<META HTTP-EQUIV="refresh" CONTENT="5; URL=1.html">

Other uses


expires
Indicates the date and time after which the document should be considered
expired. Web robots may use this information to delete expired documents
from a search engine index.


content-type
The content-typetext/htmlis automatically added to the HTTP header for
HTML documents, but this attribute can be extended to include the character
set for the document. This causes the browser to load the appropriate char-
acter set before displaying the page.

Free download pdf