Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh Page for interval using js

Tags:

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).

like image 373
RaceBase Avatar asked Aug 20 '12 13:08

RaceBase


People also ask

How do you refresh a page using JavaScript?

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).

Does setInterval refresh the page?

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.

How do you refresh a page every 5 seconds?

setTimeout(function () { location. reload(1); }, 5000);

How do I refresh a page after some time?

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.


1 Answers

Just insert this code anywhere in the page:

<script type="text/javascript">   setTimeout(function(){     location = ''   },60000) </script> 
like image 88
Abraham Avatar answered Sep 30 '22 20:09

Abraham