WebExtensions
WebExtension manifest files
| Type | object |
|---|---|
| File match |
manifest.json
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/webextensions/latest.json |
| Source | https://www.schemastore.org/webextension.json |
Validate with Lintel
npx @lintel/lintel check
The manifest.json file is the only file that every extension using WebExtension APIs must contain.
Using manifest.json, you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality (such as background scripts, content scripts, and browser actions).
It is a JSON-formatted file, with one exception: it is allowed to contain "//"-style comments.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json
Properties
This key specifies the version of manifest.json used by this extension.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/manifest_version
Name of the extension. This is used to identify the extension in the browser's user interface and on sites like addons.mozilla.org.
It's good practice to keep the name short enough to display in the UI. Also, the length of the name of a published extension may be limited.
These restrictions do not apply to self-hosted extensions or extensions distributed outside the stores.
This is a localizable property.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/name
The version string for the extension.
The version string consists of 1 to 4 numbers separated by dots, for example, 1.2.3.4. Non-zero numbers must not include a leading zero.
Extension stores and browsers may enforce or warn if the version string doesn't comply with this format. They may also apply restrictions to the range of numbers available.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/version
The extension's author, intended for display in the browser's user interface. If the developer key is supplied and it contains the "name`" property, it will override the author key. There's no way to specify multiple authors.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/author
Use the background key to include one or more background scripts, a background page, or a Service worker in your extension.
Background scripts are the place to put code that needs to maintain a long-term state or perform long-term operations independently of the lifetime of any particular web pages or browser windows.
Background scripts are loaded as soon as the extension is loaded and stay loaded until the extension is disabled or uninstalled unless persistent is specified as false. You can use any WebExtension APIs in the script if you have requested the necessary permissions.
See Background scripts for some more details.
The background key is an object that must have one of these properties (for more information on how these properties are supported, see Browser support)
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background
5 nested properties
If you need specific content in the background page, you can define a page using the page property. This is a String representing a path relative to the manifest.json file to an HTML document included in your extension bundle.
If you use this property, you can not specify background scripts using scripts, but you can include scripts from the page, just like a normal web page.
An Array of Strings, each of which is a path to a JavaScript source. The path is relative to the manifest.json file itself. These are the scripts that are executed in the extension's background page. The scripts share the same window global context. The scripts are loaded in the order they appear in the array. If you specify scripts, an empty page is created where your scripts run. Note: If you want to fetch a script from a remote location with the