Manifest V3 Anatomy

Anatomy of a Manifest V3 Extension

An extension is a folder of web files plus manifest.json, which names entry points and permissions. Each piece has its own context: the background service worker handles events, content scripts run inside web pages, and extension pages (popup, side panel, options) are HTML documents served from a chrome-extension://<id>/ origin.

link-counter/manifest.jsonJSON
{
  "manifest_version": 3,
  "name": "Link Counter",
  "version": "1.0.0",
  "description": "Counts the links on each page and shows the total on the toolbar badge.",
  "action": { "default_title": "Link Counter", "default_popup": "popup.html" },
  "background": { "service_worker": "background.js", "scripts": ["background.js"] },
  "content_scripts": [
    { "matches": ["https://*/*"], "js": ["content.js"], "run_at": "document_idle" }
  ],
  "permissions": ["storage"]
}

permissions unlocks APIs, while URL patterns in host_permissions or content-script matches grant site access and trigger the install warning, so ask for as little as possible. Firefox 555 has no extension service workers and runs background.scripts instead; Chrome 121 1 and later ignore that key, so listing both works everywhere. All code must ship inside the package, because Manifest V3 forbids remotely hosted code. To try the extension, click Load unpacked on chrome://extensions with Developer mode on, or use about:debugging in Firefox.