Location reload() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Location

Description

The reload() method reloads the current document, which does the same as the reload button in your browser.

reload() method reloads the page from the cache, to force it to reload the page from the server use location.reload(true).

Parameter Values

Parameter TypeDescription
forceGet Boolean Optional.

Specifies the type of reloading:

  • false - Default. Reloads the current page from the cache.
  • true - Reloads the current page from the server

Return Value

No return value

The following code shows how to Reload the current document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Reload page</button>

<script>
function myFunction() {/*from  w  w w.  j a v a 2 s. co m*/
    location.reload();
}
</script>

</body>
</html>

Related Tutorials