This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
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.
back()
None.
None (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.
<button id="go-back">Go back!</button>
document.getElementById("go-back").addEventListener("click", () => {
history.back();
});
| Specification |
|---|
| HTML> # dom-history-back-dev> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
back |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/History/back