Blog > detail

Just my tiny mind

Reload Page Periodically with JavaScript or PHP

26-2-2012 Admin General 2 Comments

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.

Reload Page Periodically with JavaScript or PHP Reload Page Periodically with JavaScript or PHP Reload Page Periodically with JavaScript or PHP

Reload Page Periodically with JavaScript or PHP Reload Page Periodically with JavaScript or PHP Reload Page Periodically with JavaScript or PHP

Reload Page Periodically with JavaScript or PHP

word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word

Reload Page Periodically with JavaScript or PHP

Reload Page Periodically with JavaScript or PHP

Reload Page Periodically with JavaScript or PHP