History.forward()

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

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

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

Specifications

Specification
HTML Standard
# dom-history-forward-dev

Browser compatibility

BCD tables only load in the browser

See also