HOW TO PAGE REFRESH USING JAVASCRIPT WITH EXAMPLE

JavaScript is used to make the  web pages interactive. Using java script we can do many thing without need of the server side page refresh.

Here i write how we can reload or refresh the same page using the java script.
Some times it required to web developer to refresh the page using the java script when it called the ajax method or it any purpose of timer logic etc.
 

refresh page using javacript

 
Syntax to Refresh or Reloading a Webpage using java script

JavaScript use the reload method to reload the webpage.

location.reload ();

You can change the default cache reload by setting a forceGet parameter. This will cause the browser to reload the webpage by fetching the data from the server anew instead of using the cache. This can be accomplished by using the following code: 

location.reload (true);

Example – A Web Page Refresh 

<html>

<body>

Click on the Hyperlink to Reload the Page:

<button onclick=”javascript:location.reload(true)” type=”submit” value=”Refresh Page”></button>

<a href=”javascript:location.reload(true)”>Reload Page</a>

</body> </html>

Leave a Reply

Your email address will not be published. Required fields are marked *