Latest web development tutorials

History length property

History Object Reference History Object

Definition and Usage

length attribute declares the browser history list the number of elements.

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

grammar

history.length


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support length property


Examples

Examples

Returns the number of URL in the history list:

<script>

document.write("历史列表中URL的数量: " + history.length);

</script>

Examples of the above output:


try it"


History Object Reference History Object