History lengthProperty

History 对象参考手册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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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>

The output of the above example:


Try it Yourself »


History 对象参考手册History Object Other Extensions