Reload Page Periodically with JavaScript or PHP

Reload Page Periodically with JavaScript or PHP

Do you know how to Reload Page Periodically with JavaScript or PHP ? If you dont, then you are visiting a correct blog. In this article Ill explain how to Reload Page Periodically with JavaScript or PHP.

Reload Page Periodically with JavaScript or PHP can be usefull for reloading your website page. Reloading the page can be usefull for giving an up to date information to the user.

Enough the chit-chat and jump to the code already.
First is JavaScript code:

setTimeout('window.location.reload();', 5000);

Second is PHP code:

$page = $_SERVER['PHP_SELF'];
$wait = "5";//in second
header("Refresh: $wait; url=$page");

Just copy Reload Page Periodically with JavaScript or PHP codes into your php or html file. Just to keep in mind, you can put the above javascript anywhere in your file. However, you only can put the php code anywhere in the file as long as there is no echo or text printed to be viewed before the php code. To make it save, just put the php code in the top of the file.

Hope this Reload Page Periodically with JavaScript or PHP article is useful for you.

http://septiadi.com/2011/04/14/reload-page-periodically-with-javascript-or-php/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: