How can i refresh a page for every one minute using javascript. Note: I don't have control/option to edit HTML body tag (where we usually call onload function).
In JavaScript, you refresh the page using document. location. reload() . You can add the true keyword to force the reloaded page to come from the server (instead of cache).
The JavaScript setInterval() method calls a function or executes a code repeatedly at specified time intervals. Here in this post, I'll show you a simple example on how to refresh or reload a web page every 10 Seconds using the JavaScript setInterval() method.
setTimeout(function () { location. reload(1); }, 5000);
Auto Refresh You can also use JavaScript to refresh the page automatically after a given time period. Here setTimeout() is a built-in JavaScript function which can be used to execute another function after a given time interval.
Just insert this code anywhere in the page:
<script type="text/javascript"> setTimeout(function(){ location = '' },60000) </script>
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