Note: This article describes manifest.json for web extensions. If you are looking for information about the manifest.json in PWAs, check out the Web App Manifest article.
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.
manifest.json
keys are listed below:
"manifest_version"
, "version"
, and "name"
are the only mandatory keys."default_locale"
must be present if the "_locales
" directory is present, and must be absent otherwise."browser_specific_settings"
is not supported in Google Chrome.You can access your extension's manifest from the extension's JavaScript using the runtime.getManifest()
function:
browser.runtime.getManifest().version;
The block below shows the basic syntax for some common manifest keys.
Note: This is not intended to be used as a copy-paste-ready example. Selecting the keys you'll need depends on the extension you are developing.
For complete example extensions, see Example extensions.
{ "browser_specific_settings": { "gecko": { "id": "[email protected]", "strict_min_version": "42.0" } }, "background": { "scripts": ["jquery.js", "my-background.js"], }, "browser_action": { "default_icon": { "19": "button/geo-19.png", "38": "button/geo-38.png" }, "default_title": "Whereami?", "default_popup": "popup/geo.html" }, "commands": { "toggle-feature": { "suggested_key": { "default": "Ctrl+Shift+Y", "linux": "Ctrl+Shift+U" }, "description": "Send a 'toggle-feature' event" } }, "content_security_policy": "script-src 'self' https://example.com; object-src 'self'", "content_scripts": [ { "exclude_matches": ["*://developer.mozilla.org/*"], "matches": ["*://*.mozilla.org/*"], "js": ["borderify.js"] } ], "default_locale": "en", "description": "...", "icons": { "48": "icon.png", "96": "[email protected]" }, "manifest_version": 2, "name": "...", "page_action": { "default_icon": { "19": "button/geo-19.png", "38": "button/geo-38.png" }, "default_title": "Whereami?", "default_popup": "popup/geo.html" }, "permissions": ["webNavigation"], "version": "0.1", "user_scripts": { "api_script": "apiscript.js", }, "web_accessible_resources": ["images/my-image.png"] }
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
author |
Yes |
14
This key is mandatory in Microsoft Edge.
|
52 |
? |
Yes |
14
Not displayed in Safari Extensions preferences.
|
? |
? |
52 |
? |
? |
? |
background |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
browser_action |
Yes
If an extension defines a browser action, it is not allowed to define a page action as well.
|
14 |
48 |
? |
Yes
If an extension defines a browser action, it is not allowed to define a page action as well.
|
14
If an extension defines a browser action, it is not allowed to define a page action as well.
|
? |
? |
55 |
? |
? |
? |
browser_specific_settings |
No |
15-79 |
48
42
Mandatory before Firefox 48.
|
? |
No |
14
Supports
strict_min_version and strict_max_version in a safari block. |
? |
? |
48
42
Mandatory before Firefox 48.
|
? |
? |
? |
chrome_settings_overrides |
Yes |
79 |
55 |
? |
No |
No |
? |
? |
No |
? |
? |
? |
chrome_url_overrides |
Yes |
79 |
54 |
? |
No |
14.1 |
? |
? |
No |
? |
? |
? |
commands |
Yes |
79 |
48 |
? |
Yes |
14
Ability to change the keyboard shortcut for a command not supported.
|
? |
? |
No |
? |
? |
? |
content_scripts |
Yes
Content scripts are not applied to tabs already open when the extension is loaded.
|
14 |
48 |
? |
Yes
Content scripts are not applied to tabs already open when the extension is loaded.
|
14
Content scripts are not applied to tabs until the user grants permission via the extension's access popover in the toolbar.
|
? |
? |
48 |
? |
? |
? |
content_security_policy |
Yes |
14
Only the default content security policy is supported: "script-src 'self'; object-src 'self';".
|
48
Firefox does not support 'http://127.0.0.1' or 'http://localhost' as script sources: they must be served over HTTPS.
|
? |
Yes |
14 |
? |
? |
No |
? |
? |
? |
default_locale |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
description |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
developer |
No |
No |
52 |
? |
Yes |
No |
? |
? |
52 |
? |
? |
? |
devtools_page |
Yes |
79 |
54 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
externally_connectable |
Yes |
79 |
No
See bug 1319168.
|
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
homepage_url |
Yes |
79 |
48 |
? |
Yes |
14
Not displayed in Safari Extensions preferences.
|
? |
? |
48 |
? |
? |
? |
icons |
Yes
Chrome does not support SVG format for icons. It is recommended to use PNG images.
|
14 |
48 |
? |
Yes |
14
SVG icons are not supported.
|
? |
? |
48 |
? |
? |
? |
incognito |
Yes |
≤18 |
48 |
? |
Yes |
No |
? |
? |
48 |
? |
? |
? |
manifest_version |
4 |
14 |
48 |
? |
15 |
14 |
? |
? |
48 |
? |
? |
? |
name |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
offline_enabled |
Yes |
79 |
No |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
omnibox |
Yes |
79 |
52 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
optional_permissions |
Yes |
79 |
55 |
? |
Yes |
14 |
? |
? |
55 |
? |
? |
? |
options_page |
Yes |
14 |
No |
? |
15 |
14 |
? |
? |
No |
? |
? |
? |
options_ui |
40 |
79 |
48 |
? |
27 |
14 |
? |
? |
57 |
? |
? |
? |
page_action |
Yes
If an extension defines a page action, it is not allowed to define a browser action as well.
49
Since Chrome 49, page actions are displayed on the toolbar, rather than in the address bar.
|
14 |
48 |
? |
Yes
If an extension defines a page action, it is not allowed to define a browser action as well.
|
14
If an extension defines a page action, it is not allowed to define a browser action as well.
|
? |
? |
Yes |
? |
? |
? |
permissions |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
protocol_handlers |
No |
No |
54 |
? |
No |
No |
? |
? |
54 |
? |
? |
? |
short_name |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
sidebar_action |
No |
No |
54 |
? |
30 |
No |
? |
? |
No |
? |
? |
? |
storage |
Yes |
79 |
No |
? |
No |
14 |
? |
? |
No |
? |
? |
? |
theme |
Yes |
79 |
55 |
? |
No |
No |
? |
? |
Yes |
? |
? |
? |
theme_experiment |
No |
No |
63 |
? |
No |
No |
? |
? |
No |
? |
? |
? |
user_scripts |
Yes |
79 |
68 |
? |
No |
No |
? |
? |
68 |
? |
? |
? |
version |
Yes
Valid Chrome versions are a subset of valid Firefox versions.
|
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
version_name |
Yes |
79 |
No |
? |
Yes |
14 |
? |
? |
No |
? |
? |
? |
web_accessible_resources |
Yes |
14 |
48 |
? |
Yes |
14 |
? |
? |
48 |
? |
? |
? |
For a full overview of all manifest keys and their sub-keys, see the full manifest.json
browser compatibility table.
permissions
JavaScript API
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json