How to Auto Refresh Page Every 10 Seconds

By | 5th September 2019

There are multiple solutions for this. If you want the page to be refreshed you actually don’t need JavaScript, Just a simple line of code in the head section can refresh the page

<meta http-equiv=”refresh” content=”30″/>

The browser will then refresh the page every 30 seconds.

If you want refresh the page with javascript code you could use like this

<script language=”javascript”>
setTimeout(function(){
window.location.reload(1);
}, 60*1000);
</script>

Use setInterval instead of setTimeout. setTimeout inherently triggers only once setInterval continues indefinitely.

<script language=”javascript”>
setInterval(function(){
window.location.reload(1);
}, 60*1000);
</script>

Leave a Reply

Your e-mail address will not be published. Required fields are marked *