English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The history object contains the URLs that the user has visited.
The History object iswindow (Window)Part of the object that can be written without the window prefix.
The History object allows manipulation of the browser's session history, that is, the pages accessed in the tabs or frames loaded in the current page.
To protect user privacy, there are some restrictions on how JavaScript accesses this object.
The following table lists the properties of the History object:
Property | Description |
---|---|
length | Returns the number of URLs in the history list, including the currently loaded page |
The following table lists the methods of the History object:
Method | Description |
---|---|
back() | Navigate to the previous page in the session history, which is the same operation as the user clicking the 'Back' button in the browser |
forward() | Navigate to the next page in the session history, which is the same operation as the user clicking the 'Forward' button in the browser |
go() | Load the page from the session history, which is identified by its relative position to the current page, for example, the previous page is-1or the next page is1 |