JavaScript History length Tutorial

In this section, we will learn what the History length property is and how to use it in JavaScript.

JavaScript History length Property

When we want to know how many URLs have been visited via a browser window, we can use the `length` property.

Note: The minimum value is 1 and the maximum number that the property will return is 50.

Also, this property is read only.

History length Property Syntax:

window.length

Example: using History length property in JavaScript

console.log(history.length);

Output: 2

Note: the output varies depending on the number of URLs that you visited with the current browser window.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies