How to use JavaScript Location reload

In this article I have described about Dom Node Location reload() method in JavaScript.
  • 2329

JavaScript Location reload() method

  • As we know that location object contains information about the current URL.
  • The location object has a method named reload() method that reload current document.

Browser support

Following are the main browsers which support the reload() method of location object

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

Syntax

The reload() method of location object has following syntax

location.reload()

Lets take an example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

    function reloadPage()

    {

        window.location.reload()

    }

</script>

</head>

<body style ="background-color:yellow">

<input type="button" value="Reload page" onclick="reloadPage()" />

</body>

</html>

OUTPUT

reload1.jpg

When we click on button it reload the current document

Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2018 DotNetHeaven. All rights reserved.