History
The History allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in. History object accessible via window.history or variable history.
properties
property | description |
---|---|
length | The number of elements in the session history, including the currently loaded page. For a page loaded in a new tab this property equal 1. |
state | Any value that represents the state at the top of the history stack. This is a way to look at the state without having to wait for a popstate event. |
methods
method | description |
---|---|
back() |
Moves one page back in the session history. If there is no previous page, this method call does nothing.
It has the same effect as calling history.go(-1) .
|
forward() |
Moves forward one page in the session history. It has the same effect as calling history.go(1) .
|
go(delta) | Loads a specific page from the session history. You can use it to move forwards and backwards through the history depending on the value of the delta parameter. |
pushState( state, title, url) |
Adds a state to the browser's session history stack.
|