History.back()

The History.back() method 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.

Syntax

history.back()

Examples

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

Specification Status Comment
HTML Living Standard
The definition of 'History.back()' in that specification.
Living Standard No change from HTML5.
HTML5
The definition of 'History.back()' in that specification.
Recommendation Initial definition.

Browser Compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
backChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support 10Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

See also