HTML

Auto Refresh Webpage with PHP, HTML and JavaScript

I’m developing server checking & monitoring webpage. I would left the page open all the time on my browser. So it will be good to that page auto refresh every certain amount of time so I don’t have to keep hitting F5 manually to refresh.

There are a few option that I have, I can do it either by using PHP Code, HTML Meta tag or JavaScript.

For example I want to refresh the webpage every 10 seconds. The are the code.

PHP Code

<?php
   $url=$_SERVER['REQUEST_URI'];
   header("Refresh: 10; URL=$url");
?>

 

HTML Meta Tag

<meta http-equiv="refresh" content="10">

 

JavaScript

<body onload=”javascript:setTimeout(“location.reload(true);”,10000);”>