History length Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:History

Description

The length property returns the number of URLs in the history.

The property returns at least 1 for the currently loaded page.

This property is read-only.

Return Value

A Number, representing the number of entries in the session history

The following code shows how to get the number of URLs in the history list:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var x = history.length;/*from  w  w  w. j a  v  a2s .  co  m*/
document.getElementById("demo").innerHTML = x;
</script>

</body>
</html>

Related Tutorials