Automatically refresh or reload a page using JavaScript

If you want to reload or refresh the page automatically after a certain time, you can do it using JavaScript. In this article, you will see three different methods to automatically refresh or reload a page.

Different methods to auto refresh or reload a page

  1. Using setTimeout
  2. Using setInterval
  3. Using meta tag

1. Using setTimeout

If you want to reload a page after a certain time then you can use the setTimeout function.

In the second parameter, we have to pass the milliseconds so that the written function will be executed after the given milliseconds.

2. Using setInterval

If you want to reload a page after every given seconds then you can use the setInterval function.

Same as the setTimeout, we have to pass the milliseconds in the second parameter.

3. Using meta tag

In this method, you can simply use the http-equiv meta tag to refresh the content.

That’s it for today.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *