Guide to HTML
Creating Dynamic Pages

Reload | Jump to other

Automatic Reload

Sometimes it can be convenient to create a page that will automatically reload itself with a fixed interval, without any user intervention.

Basically, there are two ways of accomplishing this. The first method is done through server push, a rather complicated way that requires an open connection between client and server. The server "pushes" data to the client to display. The second way is client pull, much easier to accomplish.

Just take a look at the following example.

Source:

<html>
<head>
  <meta http-equiv="refresh" content="3">
  <title>Title goes here</title>
</head>
<body>
This page will reload automatically in 3 seconds.
</body>
</html>

The meta statement tells the browser to request the page after the specified amount of time.

Note:

To see this at work, click the button on the right to activate the example page.

Top


Automatic Link

It is also possible to switch another document, instead of reloading the same page. This can be done by modifying the previous document slightly and add a valid URL. Here's how it is done.

Source:

<html>
<head>
  <meta http-equiv="refresh" content="3; url=dynamic.html#load">
  <title>Title goes here</title>
</head>
<body>
The Dynamic HTML Documents page will be loaded in 3 seconds.
</body>
</html>

This example will return to this page and this section after 7 seconds. To see this at work, click the button on the right.

Note:



Paragraph separator