Posted on Updated on - Arjun

Auto refresh current page with regular intervals using JS

To refresh or reload active or current page using JavaScript, you can use the location.reload() and setTimeout() methods. The reload() method does the same as the reload button in your browser.The setTimeout() method calls evaluates an expression after a specified number of milliseconds.

By default, the reload() method reloads the page from the cache, but you can force it to reload the page from the server by setting the forceGet parameter to true: location.reload(true).

Example script to Auto refresh current page

Source code of a sample HTML page that reloads page with 3 seconds regular intervals.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status