The manifest.json file is a JSON-formatted file, and 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.
manifest.json keys are listed below:
- applications
- author
- background
- browser_action
- chrome_settings_overrides
- chrome_url_overrides
- commands
- content_scripts
- content_security_policy
- default_locale
- description
- developer
- devtools_page
- homepage_url
- icons
- incognito
- manifest_version
- name
- omnibox
- optional_permissions
- options_ui
- page_action
- permissions
- protocol_handlers
- short_name
- sidebar_action
- theme
- version
- web_accessible_resources
"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. "applications"
is not supported in Google Chrome, and is mandatory in Firefox before Firefox 48 and Firefox for Android.
Browser compatibility
Chrome | Edge | Firefox | Firefox for Android | Opera | |
---|---|---|---|---|---|
applications | No | No | 48 | 48 | No |
author | Yes | Yes * | 52 | 52 | Yes |
background | Yes | Yes * | 48 * | 48 * | Yes |
browser_action | Yes * | Yes * | 48 * | 55 * | Yes * |
chrome_settings_overrides | Yes | No | 55 * | No | No |
chrome_url_overrides | Yes * | No | 54 * | 54 * | Yes * |
commands | Yes * | No | 48 * | No | Yes * |
content_scripts | Yes * | Yes | 48 * | 48 * | Yes * |
content_security_policy | Yes | Yes * | 48 * | 48 * | Yes |
default_locale | Yes | Yes | 48 | 48 | Yes |
description | Yes | Yes | 48 | 48 | Yes |
developer | No | No | 52 | 52 | Yes |
devtools_page | Yes | No | 54 | No | Yes |
homepage_url | Yes | No | 48 | 48 | Yes |
icons | Yes | Yes | 48 | 48 | Yes |
incognito | Yes | No | 48 * | 48 * | Yes |
manifest_version | Yes | Yes | 48 | 48 | Yes |
name | Yes | Yes | 48 | 48 | Yes |
omnibox | Yes | No | 52 | No | Yes |
optional_permissions | Yes * | No | 55 * | 55 * | Yes * |
options_ui | Yes * | No | 52 * | No | Yes * |
page_action | Yes * | Yes * | 48 | No | Yes * |
permissions | Yes | Yes * | 48 * | 48 * | Yes |
protocol_handlers | No | No | 54 | 54 | No |
short_name | Yes | Yes | 48 | 48 | Yes |
sidebar_action | No | No | 54 * | No | Yes * |
theme | Yes | No | 55 | No | No |
version | Yes * | Yes | 48 | 48 | Yes |
web_accessible_resources | Yes | Yes | 48 | 48 | Yes |
Example
Quick syntax example for manifest.json:
{ "applications": { "gecko": { "id": "addon@example.com", "strict_min_version": "42.0" } }, "background": { "scripts": ["jquery.js", "my-background.js"], "page": "my-background.html" }, "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": "icon@2x.png" }, "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", "web_accessible_resources": ["images/my-image.png"] }
Document Tags and Contributors
Tags:
Contributors to this page:
andrewtruongmoz,
wbamberg,
timdream,
22samuelk,
Makyen,
Standard8,
evilpie,
erxin,
kmaglione
Last updated by:
andrewtruongmoz,