HTML and CSS Reference
In-Depth Information
One other
<meta>
tag attribute that's very cool is
http-equiv
set in the
Refresh
state.
Using this attribute, you can automatically refresh a page or even change HTML pages. For
example, you could have part of your site have an automatic slide show to display photos of a
party or friends in a club. h e tag format for using the
Refresh
state is:
<
meta http
-
equiv
=
”Refresh”
content
=
”[secs]”
>
For example, the following tag refreshes (reloads) the page every 30 seconds:
<
meta http
-
equiv
=
”Refresh”
content
=
”30”
>
Not only can you reload the same page, but you can reload dif erent pages. If you want to load
a sequence of pages, you can set the initial meta tag set as follows, to set the page assigned as a
URL value at er
1
⁄
2
second:
<
meta http
-
equiv
=
”Refresh”
content
=
”.5; URL=pg2.html”
>
Notice how the content value of both the number of seconds and the URL are in the same set
of quotation marks. h e following HTML5 code launches a series of pages that keep refresh-
ing until a home page is loaded:
<!
DOCTYPE HTML
>
<
html
>
<
head
>
<
meta http
-
equiv
=
”Content-Type”
content
=
”text/html; charset=UTF-8”
>
<
meta http
-
equiv
=
”Refresh”
content
=
”.5; URL=pg2.html”
>
<
title
>
Image
1
</
title
>
</
head
>
<
body
>
<
img src
=
”one.png”
alt
=
”one”
>
</
body
>
</
html
>
88
At er the initial page, you would have the following sequence — only one per page:
Page 2:
<meta http-equiv=”Refresh” content=”.5; URL=pg3.html”>
Page 3:
<meta http-equiv=”Refresh” content=”.5; URL=pg4.html”>
Page 4:
<meta http-equiv=”Refresh” content=”.5; URL=pg5.html”>
Page 5:
<meta http-equiv=”Refresh” content=”.5; URL=homeNow.
html”>
h e home page,
homeNow.html
, would have no
Refresh
state in the
<meta>
tag. In fact,
other than the meta element with the
Content-Type
, it would have no other meta tag. (h is
thing would go on forever if you looped the home page back to the i rst page!)