Loading Pages Automatically using Client-Pull

by kalai 2008-04-30 20:02:57

Client-Pull refers to a technique that enables a browser/client to request (or "pull") data from the server automatically without the user-intervention.

The key property here is "without user-intervention." If not for this attribute, then the term is meaningless because it will be no different than when an user enters an URL to request a page.

With this capability, it is possible to have a web page that refreshes/reload itself; or even a web page that loads another page, without the user doing anything.

How To
Client pull can be done via cgi, by outputting this http header

Refresh: numOfsecond; URL=someURL

But the good news is that it can also be accomplished by using META tag within a html page. The syntax is as follows:

<META HTTP-EQUIV="Refresh"
CONTENT="X[; URL=http://whatever.com/something.html]">

where:

* X is the number of seconds before the reload/refresh; and
* URL is the URL of the page to be loaded. Note that according to Netscape, this should be a fully qualified URL (complete with the site's domain name); although I've seen it work with relative URL. Also, this doesn't actually have to be a html page, it can be an image, or whatever.

Note that the URL field is optional.


Example:1 Page refresh automatically without user intervention

<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="2">
<TITLE>Page</TITLE>
</HEAD>

Example :2 save the code as sample.html

<HEAD>
<META HTTP-EQUIV="Refresh"
CONTENT="2; URL=http://www.permadi.com/page2.html">
<TITLE>Page</TITLE>
</HEAD>

URL http://www.permadi.com/page2.html is automatically loaded in the browser when sample.html file is executed without and user click

Tagged in:

1991
like
1
dislike
0
mail
flag

You must LOGIN to add comments