JavaScript Page Refresh



You can refresh a web page using JavaScript location.reload method. This code can be called automatically upon an event or simply when the user clicks on a link. If you want to refresh a web page using a mouse click, then you can use the following code −

Refresh Page

To understand it in better way you can Refresh Page.

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.

Example

Try the following example. It shows how to refresh a page after every 5 seconds. You can change this time as per your requirement.


   
      
      
      
   
   
   
      

This page will refresh every 5 seconds.

Output

This page will refresh every 5 seconds.
javascript_page_redirect.htm
Advertisements