×

Html & Html5

it training classes Logo

The World's best Software Development Study Portal

Js History Object



If we want to check the URLs visited by an array we can use this history object of Javascript. We can also able to load the previous, fowars or particular any page

Let's understand some examples below



Length of the history object

Through this property we can access the length of the URLs visited by any user.

Let's take an example:-

<html>

<body>

<script>

       document.getElementById('check').innerHTML = history.length;

  }

</script>

<button type="button" id="btnid" onclick="visitedurl()> Click Here </button>

<p id="check"> </p>

</body>

</html>

Output of this program




Some properties and methods are described below :-

Methods/Property Description
length returns the length of the history URLs.
forward() returns to the next page.
back() returns to the previous page.
go() go to the particular page.






JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute