May 06, 2021 JavaScript
The window.history object contains the history of the browser.
Window.history objects can be written without the prefix window.
To protect user privacy, JavaScript's access to the object is restricted.
Some methods:
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:
The above code output is:
The 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:
The above code output is:
JavaScript Standard Reference Tutorial: JavaScript History Object