forward()

Moves forward one page in the session history. It has the same effect as calling history.go() with a delta parameter of 1.

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

Syntax

window.history.forward();

Examples

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

HTML

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

JavaScript

window.onload = function(e) {
  document.getElementById('go-forward').addEventListener('click', e => {
    window.history.forward();
  })
}

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'History' in that specification.
Living Standard No change from HTML5.
HTML5
The definition of 'History' 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
forwardChrome 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 ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also