History lengthProperty
History Object
Definition and Usage
The length property declares the number of elements in the browser history list.
Note:Internet Explorer and Opera start from 0, while Firefox, Chrome, and Safari start from 1.
Syntax
history.length
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the length property.
Example
Example
Return the number of URLs in the history list:
<script>
document.write("Number of URLs in history list: " + history.length);
</script>
document.write("Number of URLs in history list: " + history.length);
</script>
The output of the above example:
Try it Yourself »
History Object Other Extensions