How to use reload method from Location in Javascript

reload method

location.reload() reloads the current page.

Example


<!DOCTYPE HTML> 
<html> 
    <body> 
        <script> 
               location.reload(); //reload - possibly from cache 
        </script> 
    </body> 
</html><!--from  w ww .  j  av a 2  s .  c  o  m-->

Click to view the demo

Force a reload

To force a reload from the server, pass in true as an argument like this:


<!DOCTYPE HTML> 
<html> 
    <body> 
        <script> 
              location.reload(true); //reload - go back to the server 
        </script> 
    </body> 
</html><!--from ww  w  . jav a 2s  . co  m-->

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window