HTML and CSS Reference
In-Depth Information
Using the meta Element to Reload a Web Page
Describing your document is not the only use of the meta element. As you learned
earlier, servers transmit Web pages using a communication protocol called HTTP. You
can add information and commands to this communication stream with the http-equiv
attribute of the meta element. One common use of the http-equiv attribute is to force
browsers to refresh a Web page at timed intervals, which is useful for Web sites that pub-
lish scoreboards or stock tickers. For example, to automatically refresh a Web page every
60 seconds, you would apply the following meta element:
<meta http-equiv=”refresh” content=”60” />
Another use of the meta element is to redirect the browser from the current document
to a new document. This might prove useful to Gerry someday if he changes the URL
of his site's home page. As his readers get accustomed to the new Web address, he can
keep the old address online, automatically redirecting readers to the new site. The meta
element to perform an automatic redirect has the general form
<meta http-equiv=”refresh” content=” sec ;url= url ” />
where sec is the time in seconds before the browser redirects the user and url is the
URL of the new site. To redirect users after fi ve seconds to the Web page at http://www.
camshots.com , you could enter the following meta element:
When redirecting a Web
site to a new URL, avoid
confusion by always
including text notifying
users that the page is
being redirected, and pro-
vide users several seconds
to read the text.
<meta http-equiv=”refresh” content=”5;url= http://www.camshots.com” / >
At this point, Gerry does not need to use the meta element to send data or commands
through the HTTP communication protocol. However, he will keep this option in mind if
he moves the site to a new address.
Gerry is happy with the Web site you've started. He'll continue to work on the site
and will come back to you for more assistance as he adds new pages and elements.
Session 2.2 Quick Check
1. The CAMmap image map has a circular hotspot centered at the point (50, 75)
with a radius of 40 pixels pointing to the faq.htm fi le. Specify the code to create
a map element containing this circular hotspot.
2. An inline image based on the logo.jpg fi le with the alternate text CAMshots
needs to use the CAMmap image map. Specify the code to apply the image map
to the image.
3. What are the fi ve parts of a URL?
4. Specify the code to link the text White House to the URL http://www.
whitehouse.gov , with the destination document displayed in a new unnamed
browser window.
5. Specify the code to link the text University of Washington to the FTP server at
ftp.uwash.edu .
6. Specify the code to link the text President of the United States to the e-mail
address president@whitehouse.gov .
7. What attribute would you add to a hypertext link to display the tooltip Tour the
White House ?
8. Specify the code to add the description United States Offi ce of the President as
metadata to a document.
9. Specify the code to automatically refresh your Web document every 5 minutes.
Search WWH ::




Custom Search