Open In App
Related Articles

HTML DOM Location reload() Method

Improve Article
Improve
Save Article
Save
Like Article
Like

The location reload() method in HTML DOM is used to reload the current document. This method refreshes the current documents. It is similar to the refresh button in the browser. 

Syntax:

location.reload( forceGet )

Parameters: This method contains a single parameter forceGet which is optional. This parameter contains boolean values which are listed below:

  • True: Reloads the current page from the server.
  • False: Reloads the current from the cache.

Return Value: It does not return any value. 

Example: In this example, we will use the location reload() method

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
        HTML DOM Location reload() Method
    </title>
 
    <!--script to reload current page-->
    <script>
        function locationreload() {
            location.reload();
        }
    </script>
</head>
   
<body>
    <h1>GeeksforGeeks</h1>
    <h2>
        HTML DOM Location reload() Method
    </h2>
    <p>
        Click on the button to reload the document
    </p>
   
    <!-- script call here -->
    <button onclick="locationreload()">
        Reload page
    </button>
</body>
</html>


Output: 

 

Supported Browsers: The browser supported by DOM Location reload() Method are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5.5
  • Firefox 1
  • Opera 3
  • Safari 1
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 14 Jun, 2023
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials