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 | Status | Comment |
HTML Living StandardThe definition of 'History' in that specification. | Living Standard | No change from HTML5. |
HTML5The definition of 'History' in that specification. | Recommendation | Initial definition. |
Browser Compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
forward
|
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
History.forward() by Mozilla Contributors is licensed under CC-BY-SA 2.5.