JavaScript > Methods

Refreshing current page in JavaScript

How to reload/refresh current page in JavaScript?

In case we want to refresh the current page using JavaScript, we can follow this approach.

        document.write(new Date());
        function TestFunction() {

    <input type="button" id="btnReload" value="Reload" onclick="TestFunction()" />

In the above code on click of the button, we are executing “TestFunction” function. Inside this function we are calling the location.reload() method that reloads the current page.


 Views: 762 | Post Order: 55

Write for us