window.history frame.history history
A string that specifies the URL of the current document. Only available with data tainting enabled in Navigator 3.0.
The number of URLs that are saved in the History object.
A string that specifies the URL of the document after this one in the history list. Only available with data tainting enabled in Navigator 3.0.
A string that specifies the URL of the document before this one in the history list. Only available with data tainting enabled in Navigator 3.0.
In Navigator 3.0 and later, when the data-tainting security model is enabled, the elements of the array are available and may be read (but not changed). Also, the current, next, and previous properties are available. These properties are strings that specify the URL of the current document, and the URLs of the documents that precede and follow it in the history array. Finally, enabling data tainting also makes the toString() method of the History object functional. This method returns a string of HTML text. When this string is formatted by a browser (i.e., written with document.write()), it displays the browser history as a table of URLs, each with an appropriate hyperlink.
You can use the History object to implement your own Forward and Back buttons, or other navigation controls, within a window. This is most often useful for sites that use frames. With data tainting enabled, more sophisticated navigation aids are possible.
With or without data tainting, you can use the back(), forward(), and go() methods of the History object. The following line performs the same action as clicking the Back button:
The following performs the same action as clicking the Back button twice:
With data tainting enabled, you can access the history object as an array and read URLs directly. The first URL displayed by the current window is:
The last URL displayed by that window is:
The currently displayed URL is:
And the URLs of the documents before and after that one in the history array are: