THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

History length Property

History Object Reference History Object

Example

Get the number of URLs in the history list:

var x = history.length;

The result of x could be:

Try it yourself »

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 currently loaded page.

Tip: This property is useful to find out how many pages the user has visited in the current browsing session.

Note: Internet Explorer and Opera start at 0, while Firefox, Chrome, and Safari start at 1.

Note: Maximum length is 50.

Note: This property is read-only.


Browser Support

Property
length Yes Yes Yes Yes Yes

Syntax

history.length

Technical Details

Return Value: A Number, representing the number of entries in the session history

History Object Reference History Object