Baseline Widely available
The back()
method of the History
interface causes the browser to move back one page in the session history.
It has the same effect as calling history.go(-1)
. If there is no previous page, this method call does nothing.
This method is asynchronous. Add a listener for the popstate
event in order to determine when the navigation has completed.
None.
Return valueNone (undefined
).
SecurityError
DOMException
Thrown if the associated document is not fully active. Browsers also throttle navigations and may throw this error, generate a warning, or ignore the call if it's called too frequently.
The following short example causes a button on the page to navigate back one entry in the session history.
HTML<button id="go-back">Go back!</button>
JavaScript
document.getElementById("go-back").addEventListener("click", () => {
history.back();
});
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3