🚨 Get Your Free NFT Certificate Mint by Completing the Web3 Exam! START NOW

Code has been added to clipboard!

JavaScript Refresh Page Method

Reading time 2 min
Published Aug 10, 2017
Updated Oct 2, 2019

JavaScript Refresh Page: Main Tips

  • The location.reload() method reloads the current web page.
  • The method gives the exact same result as pressing the RELOAD button in your browser.
  • The JavaScript reload page method loads the page from the cache by default. If the forceGet property is set to true, the page is reloaded from the server.
  • The JS reload page method does not have a return value.
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
  • Easy to navigate
  • No technical issues
  • Seems to care about its users
Main Features
  • Huge variety of courses
  • 30-day refund policy
  • Free certificates of completion

Using location.reload()

The JavaScript refresh page function can reload the current resource. In most cases, a page is selected to be refreshed. The method also has other perks, such as helping you get the URL address of the current page, redirect the browser to another page, and, of course, refresh page JavaScript.

The following example contains the code you can use to reload a website. Click the Try it Live button, and make modifications to the script!


The boolean parameter of this JS reload page method is automatically set as false. If you indicate true in the parentheses, the page will be reloaded from the server instead of cache.

In other words, by replacing the default false with true, you are forcing the website to be loaded from the server.

The JavaScript refresh page method is a popular choice among developers to reload webpages. The location of the document loaded on the window is found in the location variable. By invoking the location.reload(), you will perform the same kind of reload a regular browser refresh executes.

location.reload() Syntax

This is how you can call the refresh page JavaScript method from within your code (to reload from server):


We have indicated that JavaScript refresh page command can have the forceGet parameter included in the the parentheses. This parameter always has a boolean value of either true or false However, it is optional.

The forceGet parameter should be only used when developers want to force the website to reload from the server. The JavaScript refresh page function without a parameter in its parentheses will reload the page from cache.


Another way to reload the page is by using the timedRefresh command. You can specify how frequently to refresh the page, and it will do so automatically non-stop.

function timedRefresh(time) {
	setTimeout("location.reload(true);", time);