|
The Internet Connection
By Michael Sauers
Additional Uses for META in HTML Documents
Most World Wide Web developers are aware of the META element often used to add
keywords and descriptions to an HTML document. But those are not the only
valuable functions for which META can be used in web documents. Another META
attribute can be used in place of name to accomplish a couple of fairly useful tasks.
This attribute is HTTP-Equiv.
When documents are transferred using the HTTP (Hypertext Transport Protocol)
method, certain additional information about what is being transferred is also sent. By
using the HTTP-Equiv attribute, the web developer can simulate some of that
information and direct the browser to function accordingly.
The two values required to be used with the HTTP-Equiv attribute are Expires and
Refresh.
The code for the Expires value is:
<meta HTTP-Equiv="Expires" content="Sat, 01 Apr 1999 00:00:01
GMT"@>
By including the above line of code in the head (between the < > and
<> codes) of the document, an expiration date is set in the copy of the
document in the browser's cache. After the specified date and time indicated,
the cache copy is rendered invalid and the browser is forced to return to the
originating server and retrieve a fresh copy of the document.
The code for the Refresh value is:
<meta HTTP-Equiv="Refresh" content="10;
URL=http://www.bcr.org/index2.html"@>
This code, when included in the head of the web document, causes the browser to wait
10 seconds before loading the specified document. This is commonly known as a
form of server redirect. It is mainly used when a page has moved and the author
wishes the user to be routed automatically to the new location.
This code does not work in all browsers, so it is recommended that the URL of the
new location also be included as a link on the first document.
|
|