Firefox Tomorrow

web api instance method

Navigation: forward() method

View on MDN ↗

The forward() method of the Navigation interface navigates forwards by one entry in the navigation history.

Syntax

forward(options)

Parameters

  • options Optional
    • : An options object containing the following properties:
      • info Optional
        • : Developer-defined information to be passed along to the navigate event, made available in info. This can be any data type. You might, for example, wish to display newly-navigated content with a different animation depending on how it was navigated to (swipe left, swipe right, or go home). A string indicating which animation to use could be passed in as info.

Return value

An object with the following properties:

Either one of these promises rejects if the navigation has failed for some reason.

Exceptions

Examples

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

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also