Saturday, January 23, 2010

Auto Refresh / Reload Web Page

To make the page reload or refresh itself, we have to use the following code inside the head tag.
<meta http-equiv="refresh" content="5" >
The attribute http-equiv="refresh" calls for refresh of the page.

The attribute content="5" sets the time for refresh.

The time after which the page has to reload is set using the content attribute.
Say if you want the page to refresh after 10 seconds interval, set content value to 10.

We would recommend the time of refresh [reloading interval] be above 5 seconds. This is because you have to consider the page loading time.

Example , online.php with auto refresh for 60 seconds :

<?php // ---- online.php ----
include "";
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<meta http-equiv="refresh" content="60" >
<TITLE>Online User Webmail BATAN</TITLE>
<META NAME="GENERATOR" CONTENT="gEdit 2.20.3 (Linux)">
<META NAME="CREATED" CONTENT="20080304;11545200">
<META NAME="CHANGED" CONTENT="20080304;12344100">
<META NAME=author CONTENT="Muh. Sirojul Munir">
<META NAME="description" CONTENT="online user webmail">
<META NAME="keywords" CONTENT="online, webmail, batan">
<link rel="Shortcut Icon" href="/favicon.ico" />
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
$waktu=date("H:i:s d-m-Y");
$sqlLimit="select distinct ou_user from onlineusers order by ou_user asc";
//echo "$sqlRekRows";
echo "
<font color=#0aa1bc face=verdana size=5><b>ONLINE USER WEBMAIL BATAN</b></font>
echo "
Waktu saat ini: $waktu
<table width=25% class=ntn>
<th align=left>Username</th>
echo "
<tr bgcolor=".strip2($RekRows).">
<td align=left><font face=verdana size=3>$_ou_user</font></td>
echo "</table>";
echo "Total user: ";
echo "$rec_num";

Sumber :

No comments:

Post a Comment