History length Property
The length property returns the number of URLs in the history list.
Note: Internet Explorer and Opera start at 0, while Firefox, Chrome, and Safari start at 1
Use the history.length property to count the items in the history list. Unfortunately, this nugget of information is not particularly helpful in scripting navigation relative to the current location because your script cannot extract anything from the place in the history queue where the current document is located. If the current document is at the top of the list (the most recently loaded), you can calculate relative to that location. But users can use the Go/View menu to jump around the history as they like. The position of a listing in the history does not change by virtue of navigating back to that document. A history.length of 1, however, indicates that the current document is the first one the user loaded since starting the browser software.
沒有留言:
張貼留言