Skip to main content

Archive

Show more

How to refresh page on specific time using javascript

how-to-refresh-page-on-specific-time-using-javascript


Question: How to refresh page on specific time using javascript

Answer: You have seen many such websites which automatically reload the page. Sometimes we also need to add this event to our website.

So here we are going to discuss two methods. In this method we are taking the reload time of 30 seconds, you can take the time according to your requirement like 1 minute, 5 minutes, 5 seconds.


First: using 'setTimeout' concept.

window.setTimeout(function () {
  window.location.reload();
}, 30000);


Second: using 'setInterval' concept.

setInterval(function(){
   window.location.reload(1);
}, 30000);


We try to provide you the best content, if there is any mistake in this article or there is any mistake in code, then let us know.

Comments