A browser extension is a small software package that a user installs into a browser to add features or change how the browser and web pages behave. Extensions are built from the same materials as websites, HTML, CSS and JavaScript, but they run with privileges a web page does not have: they can persist across sites, add toolbar buttons and panels, read or modify pages the user visits, and observe or alter network requests, within the permissions the user grants. Firefox groups extensions under the broader add-ons label, which also includes themes.
Modern extensions follow the WebExtensions model, a cross-browser API supported with variations by Firefox and by Chromium-based browsers such as Chrome, Edge and Opera. MDN notes that extensions written for Chromium browsers usually run in Firefox with few changes, though differences remain. This article covers the components and permission model, how content scripts and background work divide the labour, how extensions differ from websites and legacy plugins, and what they cannot do.
Extension Components and Permissions
Every extension has a manifest, a JSON file named manifest.json that declares its name, version, icons, requested permissions and the files that make up each component. The manifest is the only required file; everything else is optional and depends on what the extension does.
The common components are a background script that reacts to browser events, content scripts that run inside web pages, and user interface pages such as a toolbar popup, an options page or a sidebar. Extensions may also bundle web accessible resources, such as images or scripts, that pages are allowed to load. In Manifest V3 the background script is non-persistent: it is loaded when an event needs handling and unloaded when idle, and in Chrome it takes the form of a service worker.
Extension Permissions
Extension permissions are declared in the manifest and fall into three groups. API permissions name browser capabilities, such as storage, tabs, cookies or webRequest. Host permissions are URL match patterns that grant access to specific origins, enabling cross-origin requests, programmatic script injection and reading tab URLs for those sites. The activeTab permission grants temporary access to the current tab only when the user invokes the extension, which avoids broad host access. Permissions can also be requested later as optional permissions.
Browsers show warnings at install time for permissions that affect privacy, and both MDN and Chrome's documentation advise requesting the minimum needed, partly because fewer warnings earn more installs and partly because, as Chrome puts it, permissions limit the damage if an extension is compromised. In Manifest V3, host permissions moved to a dedicated host_permissions key, and changing them in an update can trigger a new warning.
Content Scripts and Background Work
A content script is the part of an extension that touches a web page. It runs in the context of the page and can read and change the DOM using ordinary web APIs, so it can hide elements, insert buttons or extract text. It only runs on pages the extension has host permissions for, or on the active tab after a user gesture.
Content scripts normally run in a separate JavaScript world; some APIs also allow deliberate injection into the page's main world. Chrome calls this an isolated world and Firefox calls it Xray vision: a script in the default isolated world sees the same DOM but does not directly share page variables or functions, and if the page redefined a built-in method the content script still gets the original. The page, in turn, cannot read the content script's variables. The two can exchange messages through the DOM, for example with window.postMessage, and MDN warns that anything received this way must be treated as untrusted.
Content scripts have only a small slice of the extension API, chiefly storage and messaging. More privileged work, such as reading cookies or changing requests, typically runs in a background context or another extension page with the required APIs and permissions. The content script sends a message, the background script performs the action and replies. Injection can be static, declared in the manifest with match patterns, dynamic through the scripting API at runtime, or programmatic in response to an event such as a toolbar click.
Extensions vs Websites and Legacy Plugins
Three kinds of code have run in browsers, and the distinctions explain why extensions carry warnings.
| Aspect | Website | Browser extension | Legacy plugin |
|---|---|---|---|
| Technology | HTML, CSS, JavaScript | HTML, CSS, JavaScript plus extension APIs | Native binary, for example NPAPI |
| Scope | Its own origin, inside the sandbox | Across sites, as permitted | Embedded content types such as Flash |
| Installation | None | User installs, usually from a store | Separate installer |
| Status | Current | Current, via WebExtensions | No longer supported by major browsers |
A normal website is constrained by the browser sandbox and same-origin policy; it does not gain general access to unrelated tabs and sites. An extension with host permissions can. A plugin was a binary component that rendered content the browser could not handle itself, Flash being the best-known example. MDN notes that plugins caused security and performance problems, that vendors deprecated them between 2016 and 2021, and that no major browser supports them today. Browser add-on is a broader label whose exact meaning depends on the browser; extensions are its main functional category.
Common Uses
Content blockers filter advertising and trackers by matching requests against rule lists. Password managers fill credentials through content scripts. Developer tools inspect frameworks and network traffic. Productivity extensions clip pages, manage tabs or translate text. Accessibility extensions adjust contrast and reading layouts. Some extensions switch proxy settings or manage cookies for testing, and automation helpers record and replay interactions. In every case the extension's reach is bounded by the permissions it declared.
Limitations and Cross-Browser Differences
Extension APIs are not identical everywhere. MDN maintains compatibility tables because some APIs exist only in one browser, Chrome's Manifest V3 handles request modification mainly through the declarative net request API, and manifest versions differ in how background scripts and host permissions are declared. Mobile browser support varies, so an extension that works on desktop may be unavailable on a phone. One package rarely runs unchanged across every browser.
Extensions can influence some signals a website sees. With the right permissions they can rewrite request headers such as User-Agent, inject a script that overrides properties like the reported time zone or screen size, or block scripts entirely. These changes operate inside the page and request layers only. An extension does not generally replace the browser's TLS implementation or virtualise the operating system. It can, however, configure proxy routing where a browser exposes that permission, changing the exit address seen by sites. Altering a few page properties does not guarantee consistency across all browser signals. Host access is also constrained by restricted browser pages, separate frames and user settings; broad access can expose sensitive page content, but is not unrestricted access to every browser surface.