```yaml
product: AlterLab
title: "Playwright Network Interception — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/playwright-network
```

browser

# Playwright Network Interception

Playwright's route API intercepts, inspects, and modifies outgoing browser network requests, enabling scrapers to block ads, capture API responses, or mock data during tests.

Playwright's `page.route()` method installs a handler that intercepts matching requests before they are sent over the network. The handler can fulfil the request with a mock response, abort it entirely (useful for blocking images, fonts, or analytics scripts to speed up loads), modify the request URL or headers before forwarding, or simply log the request and let it pass through.

For data extraction, route interception is powerful: it allows the scraper to capture JSON API responses that power a page's dynamic content, without needing to parse the rendered HTML. The captured JSON is typically cleaner and more structured than scraped DOM content.

Route interception also enables performance optimisation: blocking resource types like `image`, `font`, `media`, and `stylesheet` reduces page load time by 50–80% for data-extraction tasks that only need HTML content, and significantly reduces bandwidth consumption in large-scale browser-based scraping.

### What is Playwright Network Interception?

Playwright's route API intercepts, inspects, and modifies outgoing browser network requests, enabling scrapers to block ads, capture API responses, or mock data during tests.

### How does AlterLab handle Playwright Network Interception?

Route interception also enables performance optimisation: blocking resource types like `image`, `font`, `media`, and `stylesheet` reduces page load time by 50–80% for data-extraction tasks that only need HTML content, and significantly reduces bandwidth consumption in large-scale browser-based scraping.

## Examples

```
// Playwright: intercept API calls to capture JSON directly
await page.route("**/api/products**", route => {
  route.continue();  // let it through but log it
});

page.on("response", response => {
  if (response.url().includes("/api/products")) {
    response.json().then(data => console.log(data));
  }
});

await page.goto("https://example.com/catalog");
```

## Related Terms

[Network InterceptionCapturing XHR/fetch API responses made by a page's JavaScript during browser rendering to extract structured data directly from network calls.](https://alterlab.io/glossary/network-interception)[PlaywrightAn open-source browser automation library from Microsoft that controls Chromium, Firefox, and WebKit through a unified async API.](https://alterlab.io/glossary/playwright)[Headless BrowserA web browser that runs without a graphical user interface, executing JavaScript and rendering pages exactly as a real browser would.](https://alterlab.io/glossary/headless-browser)[Browser ContextA browser context is an isolated browser session within a single browser process, with separate cookies, cache, and storage — enabling parallel scraping without session cross-contamination.](https://alterlab.io/glossary/browser-context)[Dynamic ContentPage content generated client-side by JavaScript after the initial HTML is served, requiring a browser engine to render.](https://alterlab.io/glossary/dynamic-content)

## Extract Playwright Network Interception data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)