Meta Refresh or forward

Section 1 - Introduction
Section 2 - Basics
Section 3 - Next Level
      Lists
      Basic Tables
      Advanced Text
      Marquee
      Meta
         Name and content
         Refresh or forward
         Keywords and description
         Once upon a time...
         You Try It!
      Sounds
      Comments
Section 4 - Advanced
Section 5 - Publishing
Section 6 - Extras
Appendices
Did ya like that? That is another wonderful example of things that meta commands can do. Meta allows a window to reload as often as you tell it to. It can also reload to another page, as you just witnessed. You're about to learn how that happens.

Within the head of the document, you can give the computer commands. One is the command to refresh. Here's how that looks:
<META HTTP-EQUIV="Refresh" CONTENT="5">
Of course, most of the capitalization is just ugly, but in this case, pretty important. The command you see above will refresh the current page with the exact same page every 5 seconds. Why would anyone want to do this? Clocks or changeable items on a page. The number contained within the content tag is the number of seconds before a page refreshes.

Most of the time you won't need to refresh to the same page. Sometimes you want to automatically redirect people onto another page. Beginning webmasters do it for fun, but experienced webmasters may have to do it out of necessity. Either way, here's how it's done:
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://html.pageofmystery.com/C51b.html">
Things to note - these two are almost identical, only the second meta tag contains a web location. This is an absolute location (meaning that it starts with http://) and not a relative location (just C51b.html). After 5 seconds on a page, the computer will automatically go to this next page. Be warned - making other people's computers jump multiple times is really cruel and isn't fun for them after a while.


Back Home Forward