History: forward() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The forward() method of the History interface causes the browser to move forward one page in the session history. It has the same effect as calling history.go(1).

This method is asynchronous. Add a listener for the popstate event in order to determine when the navigation has completed.

Syntax

js
forward()

Parameters

None.

Return value

None (undefined).

Exceptions

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.

Examples

The following examples create a button that moves forward one step in the session history.

HTML

html
<button id="go-forward">Go Forward!</button>

JavaScript

js
document.getElementById("go-forward").addEventListener("click", (e) => {
  history.forward();
});

Specifications

Specification
HTML
# dom-history-forward-dev

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
forward

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also