Web Browsers

Manifest V3 and What It Changed for Extensions

A plain explanation of Manifest V3: background workers, new blocking rules, code limits and what users and developers notice as a result.

Key takeaways

  • Background pages that stayed loaded were replaced in Chrome by service workers that start when needed and shut down when idle.
  • Request blocking moved toward declared rules that the browser applies itself, instead of extension code judging each request.
  • Extensions must ship their own code and may no longer download and run new scripts from a server.
  • Browsers implement Manifest V3 differently, so the same extension can have different abilities in Chrome, Firefox and Safari.

Manifest V3 is the third major version of the rules that browser extensions are built on. It changed how extensions run in the background, how they filter network requests, what code they may execute and how they ask for access to sites. The best known effect is on content blockers, which lost some flexibility in Chrome and had to be rebuilt around a more restricted blocking system.

The "manifest" is the manifest.json file every extension includes. Its manifest_version field tells the browser which set of rules applies. Google introduced version 3 in Chrome and then phased out version 2 over a period of years; other browsers adopted version 3 with their own choices.

Why the rules changed

The stated goals were privacy, security and performance. Under version 2, an extension could keep a hidden page running all the time, watch every network request in detail and pull fresh code from a remote server after passing store review. Each of those abilities had legitimate uses and each was open to abuse.

Critics, including developers of content blockers and some privacy advocates, argued that the new request-blocking model limited the tools people use to protect themselves, and noted that the company designing the change also earns money from advertising. Supporters argued that extensions that can read and alter every request are a serious risk, and that a browser-enforced rule system leaks less and runs faster. Both points have substance, and how much each matters depends on which extensions you rely on.

What the manifest file looks like

The manifest is a plain JSON document. A small version 3 example shows several of the changes at once:

{
  "manifest_version": 3,
  "name": "Example Filter",
  "version": "1.0.0",
  "action": { "default_popup": "popup.html" },
  "background": { "service_worker": "worker.js" },
  "permissions": ["storage", "declarativeNetRequest"],
  "host_permissions": ["https://example.com/*"],
  "declarative_net_request": {
    "rule_resources": [
      { "id": "base", "enabled": true, "path": "rules.json" }
    ]
  }
}

The action key defines the toolbar button. The background key names the service worker. permissions lists abilities, while host_permissions lists the sites the extension wants to reach. The last block points to a file of blocking rules packaged with the extension. You can open the manifest of any extension you're building in a text editor, and a JSON formatter will catch a missing comma.

From background pages to service workers

A version 2 extension often had a background page: an invisible page that could hold data in memory indefinitely. In Chrome's version 3, that role belongs to an extension service worker, which wakes to handle an event, such as a click or a message, and is shut down after a period of inactivity.

The life of an extension service worker
Shut down After inactivity the browser stops it again. Work and save It handles the event and writes any state to storage. Idle Nothing is running and no memory is held for the script. Event arrives A click, message, alarm or browser event occurs. Worker starts The browser loads the script and its event listeners. 1 2 3 4 5 Idle Nothing is running and no memory is held for the script. 1 Event arrives A click, message, alarm or browser event occurs. 2 Worker starts The browser loads the script and its event listeners. 3 Work and save It handles the event and writes any state to storage. 4 Shut down After inactivity the browser stops it again. 5

For developers this changes habits. Variables held in memory disappear, so state has to go into extension storage. Timers created with setTimeout may never fire if the worker stops, so scheduled work uses the alarms API. Event listeners must be registered at the top level of the script so the browser can find them on each restart. Service workers also have no page to draw on, so tasks that need a document, such as some audio or parsing work, use a separate offscreen document in Chrome.

Firefox's version 3 takes a different path and uses non-persistent background scripts, often called event pages, which still have a document. Developers who target both usually write code that tolerates either.

A new way to block requests

Version 2 extensions could use the webRequest API in blocking mode. The browser paused each request, handed its details to the extension's code and waited for a verdict: allow, cancel, redirect or modify. This was extremely flexible.

Chrome's version 3 steers ordinary extensions to declarativeNetRequest. The extension supplies rules in advance, and the browser matches requests against them itself. A rule looks like this:

{
  "id": 1,
  "priority": 1,
  "action": { "type": "block" },
  "condition": {
    "urlFilter": "||ads.example.com^",
    "resourceTypes": ["script", "image"]
  }
}

The non-blocking form of webRequest, which lets an extension observe requests, remains available with the right permissions. Blocking use of it in Chrome is reserved mainly for extensions installed by organization policy.

Two ways to filter a request
Blocking webRequest Extension code judges each request Logic can be arbitrary and dynamic Extension sees request details A slow extension delays the page Declarative rules Browser applies rules supplied in advance Limited to supported conditions and actions Extension need not see each request Rule counts have set limits VS Blocking webRequest Extension code judges each request Logic can be arbitrary and dynamic Extension sees request details A slow extension delays the page Declarative rules Browser applies rules supplied in advance Limited to supported conditions and actions Extension need not see each request Rule counts have set limits

What it meant for content blockers

Blockers depend on very large, frequently updated filter lists. Under declarative rules, lists are converted into rule sets. Some are static, packaged inside the extension and updated when the extension is updated. Others are dynamic, added at run time, within smaller limits. The limits have been raised and adjusted since the first proposal, so check current developer documentation for figures.

Practical consequences include:

  • Some filter syntax has no declarative equivalent and is dropped or approximated.
  • Features that decided on blocking by inspecting a response or computing a rule on the fly are harder or impossible.
  • Updates to packaged rules may arrive more slowly than a list downloaded directly.
  • Element hiding and injected scripts still work, with constraints on where that code comes from.

For everyday browsing, a well-built version 3 blocker removes a large share of ads and trackers. Power users who write custom dynamic rules notice the biggest gap. Some long-standing blockers offer a separate, lighter version 3 edition. For the underlying techniques, read how ad blockers work.

Redirecting and changing headers

Blocking isn't the only job. Some extensions redirect requests, upgrade links to HTTPS or add and remove headers, which are the small pieces of information sent along with each request and response. Declarative rules support these as action types, including redirect, upgrade of the scheme, allow and header modification.

The difference from before is that the change must be expressible in advance. A rule can say "for requests matching this pattern, remove this header" or "redirect to this address built from a pattern". It can't run arbitrary code that looks something up and then decides. Redirects and header changes also need access to the sites involved, so an extension can't quietly rewrite traffic for sites you never granted.

For privacy tools this is mostly workable. For testing and debugging tools that developers used to script freely, it sometimes means a clumsier design, with rules regenerated whenever settings change. If a developer utility you relied on lost a feature in its version 3 release, this constraint is a likely reason.

No more remotely hosted code

Version 3 requires that the JavaScript an extension runs be included in its package. It can't fetch a script from a server and execute it, and the content security policy for extension pages forbids tricks such as evaluating strings as code in most contexts.

The aim is that reviewers see the code users will run. Extensions can still download data, such as configuration files or filter lists, and change behavior based on it. That distinction means the rule reduces risk without removing it, which is one reason a trusted extension can still turn bad.

A related feature, the user scripts API, exists so that script manager extensions can run code the user chose, and it generally requires the user to enable an extra setting.

Permissions and smaller changes

Version 3 separates site access from other permissions. Sites an extension wants go in a host_permissions key, and browsers can let you grant or withhold them. In Chrome you can restrict access to on click or to chosen sites. In Firefox, host access in version 3 has been treated as something the user can control per extension, with details that vary by version.

Area Version 2 Version 3
Toolbar button browser_action or page_action Single action key
Site access Mixed into permissions host_permissions
Background Background page or scripts Service worker or event page
API style Mostly callbacks in Chrome Promises widely supported
Injecting code tabs.executeScript scripting API
Web-visible files Simple list Scoped to matching sites

How other browsers handle it

"Manifest V3" names a family of designs more than a single behavior. Chrome, Edge and other Chromium browsers broadly follow Chrome's model, though a vendor can keep or add abilities of its own, such as a blocker built into the browser that doesn't depend on extension APIs at all.

Firefox implements version 3 and added declarative rules while keeping blocking webRequest, so content blockers there can continue to judge requests with their own code. Safari supports a version 3 style of extension as well, and Apple has long offered a separate content blocker format in which the app supplies rules and the browser applies them, an approach close in spirit to declarative rules.

A cross-browser working group in the web standards community discusses common behavior for extension APIs. Progress there makes shared code easier, but developers still test each browser separately. As a user, don't assume a store listing with the same name has identical features everywhere. Read the description for the browser you actually use.

What users should do

If an old extension stopped working or was disabled with a notice that it is no longer supported, look for the developer's version 3 replacement and install it from a link on their site. Be careful: when a popular extension disappears, imitators rush to fill the gap. Apply the checks in the guide to extension risks and permissions.

If content blocking is central for you, compare options: a version 3 blocker, a browser with built-in blocking, a browser that continues to support the older request API, or DNS filtering alongside any of these. The main browsers differ here, and policies can change, so check current documentation.

Don't try to keep an unsupported old extension alive with unofficial workarounds. It stops receiving updates, which is worse than switching.

What developers should check

Migration is more than changing a number. Work through these items:

  1. Move persistent state into storage and rebuild it on startup.
  2. Replace timers with alarms for anything longer than a moment.
  3. Convert blocking rules to declarative form and test the edge cases.
  4. Bundle every library and remove remote script tags.
  5. Split site access into host_permissions and request it as narrowly as you can.
  6. Test in each target browser, especially the background context.

If you're starting fresh, begin with version 3 and a tiny feature. Writing your first extension walks through a working example.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Web Browsers →

Latest news on this topic