The window.history
object stores an array of URLs visited by the user. All the url's can whenever loaded gets stored in the object which can be used later to navigate.
The window.history
object can be written also without the window
prefix like all window objects.
Property | Description |
---|---|
history.back() | Works as clicking back button in the browser. |
history.forward() | Works as clicking forward button in the browser. |
The history.back()
method loads the previous URL in the history list. It allows the user to load whatever the previous loaded page was in the same tab.
The history.forward()
method loads the next URL in the history list. It allows the user to go to the page from which the user came back by clicking backward button.
Follow Us: