Web/API/History/back

From Get docs


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 StandardThe definition of 'History.back()' in that specification. Living Standard No change from HTML5.
HTML5The definition of 'History.back()' in that specification. Recommendation Initial definition.

Browser Compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
back Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

Full support 10

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support


See also