To abort selected requests in Puppeteer, enable request interception before navigation, then call request.abort() for matching requests and request.continue() for the rest. Every intercepted request must be resolved; otherwise it stalls.
Abort a request with Puppeteer
This example blocks image requests whose URLs end in .png or .jpg. Enable interception before navigating so the handler can resolve requests as the page loads:
As an Amazon Associate I earn from qualifying purchases.
await page.setRequestInterception(true);
page.on('request', request => {
if (request.url().endsWith('.png') || request.url().endsWith('.jpg')) {
request.abort();
} else {
request.continue();
}
});
await page.goto('https://example.com');
The handler uses Puppeteer’s legacy immediate-resolution behavior: each matching request is aborted, and every other request is continued. Replace the suffix test with a predicate that matches only the traffic you intend to block.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteChoose what to match
An HTTPRequest exposes properties including its URL, method, resource type, and whether it is a navigation request. Use the narrowest relevant condition; blocking too broadly can prevent the page from loading correctly.
#1 Best Overall
Match by URL or hostname
For example, use request.url() to check for a particular path or hostname. A hostname check is generally safer than a broad substring test, which can unintentionally match unrelated URLs.
Match by resource type or method
Use request.resourceType() when the rule should apply to a category of traffic, or request.method() when it should apply to a particular HTTP method. Combine conditions if needed so that only the intended requests are affected.
Rank #2
Resolve every intercepted request
After page.setRequestInterception(true), intercepted requests stall until they are continued, aborted, responded to, or completed using the browser cache. Ensure every branch in your handler resolves the request. Puppeteer documents abort(), continue(), and respond() as the request-resolution operations; use respond() when the page should receive a supplied response instead of making the request normally.
Windows 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 reinstallOutdated 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 matchrequest.abort() requires interception to be enabled and throws immediately if it is not. Do not enable interception after navigation if the requests you need to stop may already have started.
Handle multiple request listeners safely
If another listener or a package may also resolve requests, check whether the request has already been handled before acting. Keep the check and the resolution call together without an asynchronous gap:
page.on('request', request => {
if (request.isInterceptResolutionHandled()) return;
if (request.url().includes('/blocked-path')) {
request.abort();
} else {
request.continue();
}
});
This synchronous pattern matters because another listener can handle a request while an asynchronous handler is waiting. If a handler must do asynchronous work before deciding, check again immediately before resolving the request.
Rank #4
Cooperative interception priorities
Puppeteer also supports cooperative interception when multiple handlers need to contribute decisions. In that mode, every resolution must supply a numeric priority; the highest priority wins, and equal priorities are resolved in this order: abort, respond, continue. A handler that resolves without a priority activates legacy immediate resolution, so retain the already-handled check even when using priorities.
Free tools Windows power users keep installed
One-click scans. No signup required.
Tell an aborted request from an HTTP error
An aborted request triggers requestfailed. An HTTP response such as 404 or 503 is still a response and completes with requestfinished. That distinction helps identify whether your interception rule stopped the request or the server returned an error.
Best Value
- Used Book in Good Condition
Troubleshoot common problems
abort()throws: Confirm thatawait page.setRequestInterception(true)ran before the handler tries to abort.- The page hangs or requests never finish: Check every handler branch. With interception enabled, a request must be resolved rather than left pending.
- Requests are blocked unexpectedly: Narrow the predicate and inspect the URL, method, or resource type being matched. A broad condition can catch traffic the page needs.
- A request was already handled: Another listener or dependency may have resolved it first. Check
request.isInterceptResolutionHandled()immediately before calling a resolution method. - A request reports failure but was not blocked: Compare the event and outcome. Aborting produces
requestfailed; an HTTP status such as 404 or 503 is a response that finishes normally.
The Puppeteer API documentation identified for this guidance is version 25.12.0. Check the documentation for the version installed in your project before relying on version-specific behavior. The available API guidance does not establish every interaction with service workers, browser versions, or specialized request sources, so verify those cases in your own setup.
Or skip the browser setup
If your goal is to capture a website rather than control its individual browser requests, ScreenshotNeo provides a screenshot API and MCP server. Its API can return a screenshot or PDF in one request; it is not a replacement for Puppeteer request interception when you need to decide which requests a browser should make.
Example cURL request, using the documented API parameters (see the ScreenshotNeo API documentation):
Recommended Free Tools
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes supported 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 take screenshots, and the Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.
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.




