Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use await page.goForward() to move a Puppeteer page to the next entry in its browser history. It waits for navigation by default, returns the main resource response (or null for a same-page transition), and throws if there is no forward-history entry.

Go forward in browser history

Call goForward() on the Puppeteer Page object:

await page.goForward();

The method follows the page’s existing forward-history entry; it does not accept a destination URL. A forward entry is typically available after the page has navigated to another location and then gone back. If there is no forward entry, Puppeteer throws rather than returning a response.

Handle the case where no forward entry exists

If forward history may be missing, handle the exception at the level appropriate for your application. For example, this function returns false when traversal fails and true when the call completes. A completed call may still return null for same-page navigation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
async function tryGoForward(page) {
  try {
    await page.goForward();
    return true;
  } catch (error) {
    // Log, report, or handle the missing history entry as appropriate.
    return false;
  }
}

This catches errors from the navigation call generally; if your application needs to distinguish a missing history entry from other failures, inspect and handle the error according to the Puppeteer version and application requirements.

Choose between history traversal and a known URL

Goal Use Behavior
Move to the next entry already in the page’s history page.goForward() Traverses forward history; throws if no forward entry exists.
Move to the previous history entry page.goBack() Traverses backward history.
Open a destination you already know page.goto(url) Navigates to the specified URL rather than replaying a history entry.

For goto(), supply a URL with a scheme, such as https://. It resolves with the main resource response, including the last redirect’s response when redirects occur. It resolves to null for about:blank or for the same URL with a different hash. These are goto() details, not additional guarantees about goForward(). In headless shell mode, PDF navigation is unsupported, and a valid HTTP error status such as 404 or 500 does not by itself make goto() throw.

Wait options, timeouts, and return values

goForward(options) accepts optional navigation wait options. Its promise resolves to the main resource response, or null when the history transition is same-page. Use the options when your automation needs a particular navigation-wait condition rather than the default behavior.

Puppeteer’s page navigation-timeout setting applies to goForward(), goBack(), goto(), reload, setContent(), and waitForNavigation(). If forward navigation times out, check whether the page is still loading and whether the configured timeout is appropriate before increasing it; a timeout does not create a forward-history entry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Single-page applications and same-page transitions

Puppeteer treats a URL change as navigation even when it does not load a new document. Anchor changes and History API transitions can therefore count as navigation, including in single-page applications. When a forward-history transition changes the URL without a conventional document load, goForward() can resolve to null. Do not treat a null response alone as proof that history traversal failed.

Version and browser context

The method reference used for this guidance is Puppeteer’s next API documentation, so its contents can move as the documentation changes. Neighboring versioned API pages identify version 25.12.0; that does not establish that a project has that version installed. Check the package version and browser configuration used by your project before relying on version-specific behavior.

Puppeteer’s FAQ says that from v23.0.0 onward it supports Chrome and Firefox. It describes Chrome automation through the Chrome DevTools Protocol by default and WebDriver BiDi as the default for Firefox. Confirm your installed version and configuration when those browser or protocol details matter.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server, not a way to traverse a browser’s existing history. If your goal is to capture a page rather than move a Puppeteer tab forward, a single GET request can return an image or PDF. For example, save a WebP screenshot of a URL with cURL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.