HTML | DOM Location reload() Method

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 single parameter forceGet which is optional. This parameter contains boolean value 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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>                    

chevron_right


Output:
Before click on the button:

After click on the button: The document will reload.

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.