Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Navigation
  4. canGoBack

Navigation: canGoBack property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

ThecanGoBack read-only property of theNavigation interface returnstrueif it is possible to navigate backwards in the navigation history(i.e., thecurrentEntry isnot the first one in the history entry list),andfalse if it is not.

Value

A boolean value:true if it is possible to navigate backwards in the navigation history,false otherwise.

Examples

js
async function backHandler() {  if (navigation.canGoBack) {    await navigation.back().finished;    // Handle any required clean-up after    // navigation has finished  } else {    displayBanner("You are on the first page");  }}async function forwardHandler() {  if (navigation.canGoForward) {    await navigation.forward().finished;    // Handle any required clean-up after    // navigation has finished  } else {    displayBanner("You are on the last page");  }}

Specifications

Specification
HTML
# dom-navigation-cangoback-dev

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp