October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Identify Request Resource Types in Puppeteer

Identify how Puppeteer classifies a request with request.resourceType(), and learn when interception is—and is not—needed.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Listen for a page’s request event and call request.resourceType() on the supplied request. This passively reports the resource category Puppeteer’s rendering engine assigns; you do not need to enable request interception just to inspect it.

Read a request’s resource type

Register a listener on the page. Each callback receives an HTTPRequest; call resourceType() to get its category and url() to identify the request.

As an Amazon Associate I earn from qualifying purchases.

page.on('request', request => {
  console.log(request.resourceType(), request.url());
});

For example, to log only image requests:

page.on('request', request => {
  if (request.resourceType() === 'image') {
    console.log(request.url());
  }
});

Puppeteer’s method reference describes the result as the request’s resource type “as it was perceived by the rendering engine.” It is not a classification based only on a URL suffix: a URL ending in .png is not, by itself, the same thing as Puppeteer reporting image.

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

What values can resourceType() return?

The Puppeteer ResourceType is the lowercase form of the DevTools Protocol’s Network.ResourceType. A practical list of values documented in a historical Puppeteer issue is:

  • document
  • stylesheet
  • image
  • media
  • font
  • script
  • texttrack
  • xhr
  • fetch
  • eventsource
  • websocket
  • manifest
  • other

Treat that enumeration as a practical guide, not a promise that every Puppeteer and browser combination returns precisely the same set. Confirm behavior against the version installed in your project. The surfaced API pages carry different version labels—25.4.0 for the method, 25.10.0 for the type alias, and 25.12.0 for request and interception references—so they should not be read as one synchronized release snapshot.

Observe requests without interception

Use the page’s request event when you only need to classify or log traffic. Passive observation does not require page.setRequestInterception(true). Keeping interception off avoids adding request-handling responsibilities to a task that only reads metadata.

Intercept only when you need to change a request

To block, rewrite, or otherwise control requests, enable interception and resolve each intercepted request. For example, this blocks images and continues other requests:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.setRequestInterception(true);
page.on('request', request => {
  if (request.resourceType() === 'image') {
    void request.abort();
  } else {
    void request.continue();
  }
});

Once interception is enabled, requests stall until they are continued, responded to, aborted, or completed from browser cache. In more complex handlers, make sure each intercepted request is resolved once and handle asynchronous errors. The interception reference explains the method’s behavior and shows interception examples.

Do not confuse resource type with navigation or failure status

  • Resource category: resourceType() reports the category the rendering engine assigns, such as script or image.
  • Navigation: isNavigationRequest() answers whether the request drives the current frame’s navigation; it is a separate question from the resource category.
  • Failure: requestfailed indicates a failed request lifecycle. An HTTP response with status 404 or 503 is still an HTTP response and normally completes through requestfinished, rather than being treated as a request failure.
  • URL suffix: checking a filename extension is a different filtering strategy and does not tell you what category the rendering engine assigned.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to get a website screenshot rather than inspect Puppeteer request events, ScreenshotNeo provides a screenshot API and MCP server. Its one-call API example is:

Best Value
The SQL Programming Language: .
  • Used Book in Good Condition
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, newsletter popups, and chat widgets are removed 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 a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.