dom / latest / history / forward.html /

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

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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
forward
1
12
1
10
≤12.1
1
1
18
4
≤12.1
1
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/History/forward