Value
A reference to the History object.
Examples
js
history.back(); // equivalent to clicking back button
history.go(-1); // equivalent to history.back();
Notes
For top-level pages you can see the list of pages in the session history, accessible via the History object, in the browser's dropdowns next to the back and forward buttons.
For security reasons the History object doesn't allow the non-privileged code to access the URLs of other pages in the session history, but it does allow it to navigate the session history.
There is no way to clear the session history or to disable the back/forward navigation from unprivileged code. The closest available solution is the location.replace() method, which replaces the current item of the session history with the provided URL.
Specifications
| Specification |
|---|
| HTML # the-history-interface |