Javascript History length property returns the number of URLs stored in the browser history for the current session of browser windows being used by the visitor. Javascript history length property returns the number value based on the counting method of web browser for example Microsoft Internet Explorer counts the history URLs from 0, FireFox counts the history items from 1 and Opera web browser counts the history items from 0. You can also test the history length property by getting the initial value in each browser. FireFox returns history length value as 1 whereas Internet Explorer and Opera returns 0.

Syntax for Javascript History Length Property

history.length

or

window.history.length

You can also access the history object length property through window object of javascript.

Example of Javascript History Length Property

<script type="text/javascript" language="javascript">
    document.write(history.length);
</script>

Above example code will write the output on the web page according the number of URL visited before opening the page having this code placed in the Head section of HTML document.

Continue to next tutorial: Javascript History Back Function  to learn how to navigate to previous link using JavaScript function.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.