Windows history.length
Definition and Usage
The length property returns the number of URLs in the history list of the current browser window.
The property returns at least 1, because the list includes the current page.
This property is useful to find out how many pages the user has visited in the current browsing session.
Note
history.back()
will only work if a previous page exists in the history list.
See Also:
Syntax
history.length
Parameters
NONE |
Return Value
Type | Description |
A number | The number of entries in the history list. |
Browser Support
history.length()
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |