Saturday, June 14, 2008

Automatically refreshing a web page

Wonder how page is automatically refreshed at www.cricinfo.com live scorecard?
If you get chance, see the source of the live score card and search for tag as below:
<meta HTTP-EQUIV="Refresh" CONTENT="60">


Content = 60 means Refresh the page after every 60 second.

And how the Refresh Scorecard works?
Search for tag as below:
Refresh scorecard

Syntax: Location.reload([forceGet])

The reload method forces a reload of the window's current document, i.e. the one contained in the Location.href property.
The reload method forces a reload of the window's current document, i.e. the one contained in the Location.href property.
It behaves in exactly the same way as the browser's reload button which, by default reloads from the cache.
If, however, the user has specified that the server be checked every time for an updated version, then the reload method will do the same.
You can force an unconditional HTTP GET of the document from the server by supplying 'true' for the parameter, but this should only be done if you believe that disk and memory caches are off or broken, or you believe the server has an updated version.

Variants: Location.reload - loads from cache
Location.reload(false) - loads from cache
Location.reload(true) - loads from server

Rediff score card uses
<meta HTTP-EQUIV="Refresh" CONTENT="480">
for automatic refresh. For manual refresh they rely on JavaScript timer.

No comments:

Post a Comment