webRequest

The webRequest permission grants an extension access to observe and analyze network traffic. It is the predecessor to Manifest V3's declarativeNetRequest.

Note: In Manifest V3, webRequest is still available but is observation-only for extensions installed from the Chrome Web Store — synchronous blocking via webRequestBlocking is restricted to extensions force-installed by enterprise policy. For ad blocking and other content filtering in published extensions, use declarativeNetRequest instead.

What it does

  • Allows an extension to listen for a wide range of events in the lifecycle of a network request, such as onBeforeRequest, onBeforeSendHeaders, onHeadersReceived, and onCompleted.
  • The extension's service worker receives details about each request, including the URL, method, and headers.
  • In Manifest V3, the extension can observe the traffic but, unless force-installed by enterprise policy, cannot synchronously modify or block it.

When to use it

  • In Manifest V2: This was the primary API for ad blockers and privacy tools.
  • In Manifest V3: Its use is limited to extensions that need to observe network traffic for analytical purposes, without modifying it.
    • Developer tools that show network logs.
    • Security extensions that analyze headers for potential threats.

Manifest Declaration

This permission requires host permissions for the URLs you want to observe.

{
  "name": "My Network Analyzer",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "webRequest"
  ],
  "host_permissions": [
    "<all_urls>"
  ],
  "background": {
    "service_worker": "background.js"
  }
}

Security & Privacy

Why is it risky?

This permission allows an extension to see the address of every single piece of data your browser sends or receives. This isn't just the websites you visit, but also all the ads, images, tracking scripts, and data requests happening in the background.

This provides a complete, real-time map of your online activity and is highly sensitive. While modern extensions have more limited access, older extensions could also block or change this traffic. A malicious extension could use this to track you in detail. The modern, private alternative for content blocking is declarativeNetRequest.

API Usage Example (Read-only)

This example logs the URL of every main frame request before it is sent.

// background.js

chrome.webRequest.onBeforeRequest.addListener(
  (details) => {
    // Log only requests for the main document in a tab
    if (details.type === 'main_frame') {
      console.log(`Navigating to: ${details.url}`);
    }
  },
  {
    urls: ["<all_urls>"] // The filter for which URLs to listen to
  }
);

Extensions with the webRequest permission

Here are some popular browser extensions that use the "webRequest" permission. To explore more, try our Advanced search.

Permission Metrics

Popularity

Security Risk


Usage by Platform