March 3rd, 2003, 10:10 AM
Auto refresh page
i have seen in some sites that when a database is updated, the page is automatically refreshed without the user pressing refresh button. I saw this in espnstar.com, when score changes, a little popup window that shows the score automatically updates. I can't find the method by which it is done though i tried in vain. Is this done by a specific tag? what is its method .. pls give me some ideas
March 4th, 2003, 02:48 PM
Depending on the language used to generate the page you can send http headers to the browser.
March 5th, 2003, 07:48 AM
Can you refer any links plz
March 5th, 2003, 08:17 AM
Database servers such as my-sql are commonly driven by php, or cgi scripts. Every time your web browser such as Netscape trys to view the page, the request is sent to the server. The server then processes the php script to create a new page for you to view. The page is sent back to you where your web browser displays it. As a result you are getting a new version of the page each time, which is the dynamic nature of php. To understand it further, this server-client interaction that alows scripts to be processed server side and sent dynamicaly to the user is called the Common Gateway Interface.
The refresh can be done through the http headers that are sent or useing meta tags. Giveing a meta tag such as:
<meta http-equiv="refresh" content="5">
will force a refresh after an alocated time elapsed. Useing http headers simular to the following you can achive a forced refresh:
no-cache tells the browser not to store the page in cache, and refresh causes the page to refresh after the alocated time.
To understand this properly you would need to learn some php or cgi. But To give you an idea I hope this helps.
EDIT: How this differs from standard HTML is that with a static HTML page, every time your web browser makes the request to view the page, the same file is sent each time, and because the file is the same each time nothing changes. Whereas with php the page is re-writen each time with the new information so that you get the updated version each time.