History: forward() メソッド
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.
History.forward()
メソッドにより、ブラウザーはセッション履歴の 1 つ次のページに移動します。これは history.go(1)
を呼び出すのと同じ効果があります。
このメソッドは非同期です。移動が完了したことを検知したい場合は popstate
イベントのリスナーを追加してください。
構文
js
forward()
引数
なし。
返値
なし (undefined
)。
例
以下の例では、セッション履歴の 1 つ次のステップへ進めるボタンを作成します。
HTML
html
<button id="go-forward">Go Forward!</button>
JavaScript
js
document.getElementById("go-forward").addEventListener("click", (e) => {
history.forward();
});
仕様書
Specification |
---|
HTML # dom-history-forward-dev |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
forward |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.