Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Browser Extension Development: Manifest, APIs, Architecture and Debugging

What browser extensions are, how manifest.json and components fit together, which APIs to use, and where to find errors when building an extension.

This page summarises Chrome for Developers documentation on building extensions: zipped bundles of HTML, CSS, JavaScript, and images that customise the browser and web pages using web platform technology plus extension-only APIs.

Extensions are small programs that change how people browse: they can alter page content, extend browser behaviour, or add toolbar UI. Google describes them as applications that run inside Chrome and provide extra functionality, third-party integration, and customised experiences.

Google Chrome Extensions are applications that run inside the Chrome browser and provide additional functionality, integration with third party websites or services, and customized browsing experiences.

— Google Chrome, Frequently asked questions

An extension should pursue one clear purpose; multiple features are fine when they all serve that purpose. UI should stay minimal and intentional—from a toolbar icon to full-page overrides. Unlike ordinary web apps, extensions ship as a local package (for example a .crx from the store) and do not depend on live page content to run.

You already have what you need to start if your Chrome build supports extensions: enable Developer mode on the Extensions management page, then load an unpacked project folder. The Getting started hub links tutorials from a first Hello World extension through tab managers and service workers.

manifest.json: required configuration and Manifest V3

Section titled “manifest.json: required configuration and Manifest V3”

Every extension must include manifest.json at the project root. It tells Chrome which files matter and which capabilities the extension may use.

The manifest file, titled manifest.json, gives the browser information about the extension, such as the most important files and the capabilities the extension might use.

— Google Chrome, Architecture overview

For current development, manifest_version should be 3. New submissions to the Chrome Web Store must use Manifest V3:

Warning: The Chrome Web Store no longer accepts Manifest V2 extensions. Follow the Manifest V3 Migration guide to convert your extension to Manifest V3.

— Google Chrome, About Manifest V2

The manifest only requires manifest_version, name, and version during development; other keys control icons, permissions, background workers, popups, and content scripts. Comments (//) are allowed locally but must be removed before store upload—see the Run scripts on every page tutorial for manifest basics.

Invalid keys often block loading entirely; softer mistakes may load the extension but surface errors on the management page.

Symptom Typical cause
“Failed to load extension” / missing version Wrong key (e.g. versions) or invalid version format
Extension loads but Errors button turns red Unknown permission name (permissions are case-sensitive, e.g. activeTab not activetab)
Service worker fails to register Typo in event names (e.g. oninstalled vs onInstalled)

Details and fixes appear in Debug extensions.

Extension architecture: manifest, background, UI, content, options

Section titled “Extension architecture: manifest, background, UI, content, options”

Architecture depends on features, but capable extensions usually combine several parts:

An extension’s architecture will depend on its functionality, but many robust extensions will include multiple components:

Manifest Background Script UI Elements Content Script Options Page

— Google Chrome, Architecture overview

Manifest — Central registry of metadata, entry points, and permissions (Extension development overview).

Background / service worker (MV3) — Event-driven logic. MV3 registers a single service_worker file in the manifest; you do not call navigator.serviceWorker.register() as on a normal page (Handle events with service workers).

UI elements — Popups (action.default_popup), side panel, omnibox, context menus, override pages (new tab, bookmarks, history), themes. UI should be purposeful and minimal (Design the user interface, User interface components).

Content scripts — JavaScript injected into web pages to read or change the DOM, often declared with match patterns or injected on user action via the Scripting API (Run scripts on every page).

Options page — Lets users configure the extension without changing code (Extension development overview).

Extension pages (popups, options) are served under the chrome-extension:// scheme and may call extension APIs directly—unlike arbitrary website scripts (Manage tabs).

Extension APIs: chrome namespace, browser namespace, and Web APIs

Section titled “Extension APIs: chrome namespace, browser namespace, and Web APIs”

Most extensions call one or more Chrome Extensions APIs:

Most extensions need access to one or more Chrome Extensions APIs to function. This API reference describes the APIs available for use in extensions and presents example use cases.

— Google Chrome, API reference

Use the full catalogue in the API reference and the Extensions reference hub. MV2-only surfaces (for example browserAction, pageAction, deprecated declarativeWebRequest) are marked in the Manifest V2 API reference; new work should prefer MV3 equivalents such as action and declarativeNetRequest.

Cross-browser code: From Chrome 148, many APIs also exist under the browser.* namespace as a cross-browser alternative to chrome.*—see The browser namespace on the same API reference page.

Extensions may also use standard Web APIs (DOM, fetch, canvas, storage, and so on) like any web page, and can bundle libraries the browser does not ship (Web APIs).

APIs grouped by what builders usually need

Section titled “APIs grouped by what builders usually need”
Area Representative APIs Notes from docs
Lifecycle & messaging runtime, extension Service worker access, manifest details, events (API reference)
Toolbar & shortcuts action, commands MV3 toolbar icon; keyboard shortcuts
Tabs & windows tabs, windows, tabGroups Query, focus, group tabs (Manage tabs)
Page modification scripting, declarativeContent Inject JS/CSS; rule-based UI without reading page content
Network declarativeNetRequest, webRequest DNR blocks/modifies without viewing request bodies; webRequest can intercept in flight
Storage & identity storage, identity Persist settings; OAuth2 tokens (OAuth integration)
DevTools extension devtools.* Custom panels and network integration

Many APIs need matching permissions in the manifest; optional permissions can be requested at runtime via permissions so users grant only what is needed (API reference).

Permissions: activeTab, host patterns, and user trust

Section titled “Permissions: activeTab, host patterns, and user trust”

Host permissions and broad access trigger install warnings. Tutorials often use activeTab so code runs on the current tab only after a user gesture (clicking the action), combined with scripting to insert or remove CSS without a permanent host permission (Inject scripts into the active tab).

Success: The Scripting API does not trigger a permission warning.

— Google Chrome, Inject scripts into the active tab

Content scripts use match patterns in the manifest to decide which URLs receive automatic injection (Run scripts on every page). Extensions cannot inject into internal Chrome pages such as chrome://extensions; test on normal HTTPS pages (Getting started (MV2 tutorial)).

Debugging extensions: where each component logs errors

Section titled “Debugging extensions: where each component logs errors”

Extensions use the same Chrome DevTools as web pages, but each component logs in a different place—knowing which surface to open saves time.

Extensions can access the same Chrome DevTools as web pages. To become an expert in debugging extensions, you will need to know how to locate logs and errors of the different extension components.

— Google Chrome, Debug extensions

Component Where to look
Invalid manifest / background service worker chrome://extensions — Errors button; Inspect views for the service worker
Popup / options HTML Right-click popup → Inspect; Console panel
Content script DevTools on the host page; extension context in the console context dropdown

Only runtime errors, console.warning, and console.error from some contexts appear on the Extensions management page—not every content-script bug (Debug extensions). If the service worker fails to register, you may not get DevTools for it until the registration bug is fixed.

Use Clear all on the management page error log after fixes, then reload the extension. A manifest JSON schema in the editor helps catch invalid keys early (Debug extensions). Older MV2-oriented steps live in Debugging extensions (MV2).

For TypeScript, the chrome-types npm package tracks Chromium API surface; keep it updated for the Chrome version you target (Hello World extension).

Distribution for most developers goes through the Chrome Web Store and store policies. For outline of capabilities—UI, browser control, web modification—use Develop and the task-focused How-to index. Samples provide installable examples; Migrate covers MV2 → MV3 moves.

  1. Open chrome://extensions (or More tools → Extensions), enable Developer mode, and Load unpacked with your project root containing manifest.json.

  2. Confirm manifest_version is 3 for store-bound work and required keys (name, version) match Run scripts on every page guidance.

  3. Reload the extension after manifest changes, watch the Errors control on the management page, and inspect the service worker via Inspect views when background logic runs (Hello World extension).

  4. Exercise the extension on a normal HTTPS page (not chrome:// URLs), open DevTools on that page, and switch the console context to the extension if a content script misbehaves (Debug extensions).

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page does not match the official docs or your extension behaviour, write to yimasynthetic@gmail.com with the page URL and the exact statement you think is wrong or unclear.