My requirement is that i have a .php page that has to display some graphs/data based on data from a database. I would like refresh the page automatically and periodically so that graphs/data can be updated, as the data is obtained only on loading of the page. How can i do this ?
Click on the puzzle piece icon, then on “Easy Auto Refresh”. In the popup window, enter the number of seconds after which you want the page to refresh, then click “Start”. The page will automatically refresh every time the timer you set expires.
If you really want to do it with JavaScript, then you can refresh the page every 30 seconds with Location. reload() (docs) inside a setTimeout() : window. setTimeout( function() { window.
Approach 1: One can auto refresh the webpage using the meta tag within the head element of your HTML using the http-equiv property. It is an inbuilt property with HTML 5. One can further add the time period of the refresh using the content attribute within the Meta tag.
Maybe you can try the setTimeout javascript method
setTimeout("location.reload(true);",timeoutPeriod);
this would refresh the page on every timeoutPeriod interval.
You can use javascript.
JS function
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
Add below line on body tag.
<body onload="JavaScript:timedRefresh(5000);"> // time : 5000= 5 secs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With