Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallUse await page.goBack() on a Puppeteer Page to navigate to the previous browser-history entry. It returns a promise that resolves to an HTTPResponse or null; if the page has no prior history entry, handle the rejection.
Call page.goBack()
Call the method after the page has navigated to a new history entry. Keep the returned value only if you need the main resource response:
As an Amazon Associate I earn from qualifying purchases.
const response = await page.goBack();
The return type is Promise<HTTPResponse | null>. Puppeteer documents null for same-page navigation; when redirects occur, the resolved response is for the last redirect. Puppeteer Page.goBack() reference
Complete example
This example opens a browser, visits one page, navigates to another, then goes back and closes the browser even if an operation fails:
#1 Best Overall
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
await page.goto('https://example.org');
const response = await page.goBack();
console.log(response); // HTTPResponse or null
} finally {
await browser.close();
}
The first navigation gives the page a history entry to return to after the second navigation. Puppeteer’s Page documentation shows the launch, page creation, navigation, and browser-close lifecycle. Puppeteer Page class
History entries and single-page apps
“Previous page” means the preceding entry in the browser’s history, not necessarily a separate document loaded from the network. Puppeteer treats History API URL changes as navigation. In a single-page app, goBack() can therefore return to an earlier app state when the app created a history entry; it cannot return to a state that was never added to history. Puppeteer FAQ
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Waiting and navigation timeouts
goBack() accepts optional wait options. Set the page’s default navigation timeout in milliseconds with page.setDefaultNavigationTimeout(timeout) when the normal navigation limit does not fit your flow. Puppeteer setDefaultNavigationTimeout() reference
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →page.setDefaultNavigationTimeout(30_000);
await page.goBack();
Choose the wait behavior and timeout for the page you are automating. A timeout or failed navigation should be handled as an error rather than treated as a successful return.
Rank #3
Handle missing history and other failures
- No previous entry: When the page has no prior history entry,
goBack()throws. Catch the rejected promise if your flow may reach that state. - Navigation timeout: Adjust the wait options or default navigation timeout to match the page’s behavior, and handle a timeout rejection.
- Unexpected
null: Do not assume a response object is always returned. Same-page navigation can resolve tonull. - Unexpected destination in an SPA: Check that the app actually added the expected History API entry before calling
goBack().
try {
const response = await page.goBack();
if (response === null) {
console.log('Navigation did not produce a main-resource response.');
}
} catch (error) {
console.error('Could not go back:', error);
}
Protocol compatibility
Puppeteer’s WebDriver BiDi compatibility page lists Page.goBack() as fully supported. Chrome uses CDP by default unless BiDi is selected; Firefox uses BiDi by default. Since protocol support can vary by Puppeteer version, check the compatibility information for the version and protocol in your project. Puppeteer WebDriver BiDi support
Or skip the browser setup
If you need a screenshot rather than browser-history control, ScreenshotNeo returns an image or PDF with one GET request. For example, this cURL request saves a WebP screenshot of Stripe:
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
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 documentation for API options. Cookie banners, popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are not billed. An MCP server lets AI agents take screenshots. 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.
Frequently Asked Questions
Does page.goBack() return an HTTP response every time?
No. It resolves to an HTTPResponse or null; same-page navigation can return null.
What happens if Puppeteer has no earlier history entry?
The call throws, so catch its rejection if the page may have no entry to return to.
Quick Recap
Best Value
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.




