JavaScript Window History
JavaScript Window History
The window.history object contains the history of the browser.
Window History
The window.history object can be written without using the window prefix.
In order to protect user privacy, JavaScript’s method of accessing this object is restricted.
Some methods:
history.back() - Same as clicking the back button in the browser history.forward() - Same as clicking the forward button in the browser
Window History Back
The history.back() method loads the previous URL in the history list.
This is the same as clicking the back button in the browser:
Create a back button on the page:
Window History Forward
history forward() method loads the next URL in the history list.
This is the same as clicking the forward button in the browser:
Create a forward button on the page: