0% found this document useful (0 votes)
43 views1 page

Manifest - Json - Mozilla - MDN

The document provides an overview of the manifest.json file, which is essential for web extensions using WebExtension APIs. It details the mandatory keys, various manifest keys available in different versions, and how to access these keys at runtime. Additionally, it includes a sample JSON structure and notes on browser compatibility for various manifest keys.

Uploaded by

anas170p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Manifest - Json - Mozilla - MDN

The document provides an overview of the manifest.json file, which is essential for web extensions using WebExtension APIs. It details the mandatory keys, various manifest keys available in different versions, and how to access these keys at runtime. Additionally, it includes a sample JSON structure and notes on browser compatibility for various manifest keys.

Uploaded by

anas170p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Take our daily challenges on Scrimba until 24th December and win exciting prizes.

Join now
References Guides Plus Curriculum NEW Blog Tools Theme
Mozilla Add-ons Browser extensions manifest.json Save English US
Getting started
Filter
Concepts
User interface manifest.json In this article
List of manifest.json keys
How to
Example
JavaScript APIs
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. Browser compatibility
Manifest keys See also
manifest.json The manifest.json file is the only file that every extension using WebExtension APIs must contain.
action
Using manifest.json , you specify basic metadata about your extension such as the name and
author version, and can also specify aspects of your extension's functionality (such as background scripts,
background content scripts, and browser actions).
browser_action
It is a JSON-formatted file, with one exception: it is allowed to contain " // "-style comments.
browser_specific_settings
chrome_settings_overrides
chrome_url_overrides
List of manifest.json keys
These are the manifest.json keys; these keys are available in Manifest V2 and above unless
commands otherwise noted:
content_scripts
content_security_policy action (Manifest V3 and above)
declarative_net_request author
background
default_locale
browser_action (Manifest V2 only)
description
browser_specific_settings
developer chrome_settings_overrides
devtools page chrome_url_overrides
commands
content_scripts
content_security_policy
declarative_net_request
default_locale
description
developer
devtools_page
dictionaries
externally_connectable
homepage_url
host_permissions (Manifest V3 and above)
icons
incognito
manifest_version
name
offline_enabled
omnibox
optional_host_permissions (Manifest V3 and above)
optional_permissions
options_page
options_ui
page_action (Manifest V2 only in Chrome)
permissions
protocol_handlers
short_name
sidebar_action
storage
theme
theme_experiment
user_scripts (Manifest V2 only)
version
version_name
web_accessible_resources

Notes about manifest.json keys


"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.

Accessing manifest.json keys at runtime


You can access your extension's manifest from the extension's JavaScript using the
runtime.getManifest() function:

JS

browser.runtime.getManifest().version;

Example
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.
JSON

{
"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"]
}

Browser compatibility
Report problems with this compatibility data on GitHub
diordnA rof xoferiF
SOi no irafaS
emorhC

xoferiF
arepO
irafaS
egdE

action 88 88 109 74 15.4 109 15.4

action.browser_style No No 109 No No No No
117

action.default_area
No No 109 No No No No

action.default_icon 88 88 109 74 16.4 109 16.4

action.default_popup
88 88 109 74 15.4 109 15.4

action.default_title 88 88 109 74 15.4 109 15.4

action.theme_icons
No No 109 No No No No

author 58 14 52 45 14 52 15

background
54 14 48 41 14 48 15

background.page 72 14 48 60 14 48 15

background.persistent 58 14 48 45 14.1 48 15.4

background.preferred_environment
No No No No 18 No 18

background.scripts 72 14 48 60 14 48 15

background.service_worker 88 88 No 74 15.4 No 15.4

background.type
92 92 112 78 16.4 112 16.4

browser_action 54 14 48 41 14 55 15

browser_action.browser_style
No No 48 No No No No

browser_action.default_area
No No 54 No No No No

browser_action.default_icon 58 14 48 45 16.4 79 16.4

browser_action.default_popup
58 14 48 45 14 57 15

browser_action.default_title 58 14 48 45 14 55 15

browser_action.theme_icons
No No 56 No No No No

browser_specific_settings No 15 42 No 14 42 15
18

browser_specific_settings.gecko No No 42 No No 42 No

browser_specific_settings.gecko_android No No No No No 113 No

browser_specific_settings.safari No No No No 14 No 15

chrome_settings_overrides
58 79 55 No No No No

chrome_settings_overrides.homepage
59 79 55 No No No No

chrome_settings_overrides.search_provider
58 79 55 No No No No

search_provider.alternate_urls
59 79 No No No No No

search_provider.encoding
59 79 65 No No No No

search_provider.favicon_url
59 79 55 No No No No

search_provider.image_url
59 79 No No No No No

search_provider.image_url_post_params
59 79 No No No No No

search_provider.instant_url
59 79 No No No No No

search_provider.instant_url_post_params
59 79 No No No No No

search_provider.is_default 59 79 57 No No No No

search_provider.keyword
59 79 55 No No No No

search_provider.name
59 79 55 No No No No

search_provider.prepopulated_id
59 79 No No No No No

search_provider.search_url
59 79 55 No No No No

search_provider.search_url_get_params
No No 68 No No No No

search_provider.search_url_post_params
59 79 64 No No No No

search_provider.suggest_url
59 79 64 No No No No

search_provider.suggest_url_get_params
No No 68 No No No No

search_provider.suggest_url_post_params
59 79 64 No No No No

chrome_settings_overrides.startup_pages
58 79 No No No No No

chrome_url_overrides 58 79 54 No 14.1 No 15

chrome_url_overrides.bookmarks
58 79 No No No No No

chrome_url_overrides.history
58 79 No No No No No

chrome_url_overrides.newtab 59 79 54 No 14.1 No 15

commands 25 79 48 15 14 No 15

commands.F1-F12
No No 53 No 14 No 15

commands.MediaNextTrack 58 79 57 45 No No No

commands.MediaPlayPause 58 79 57 45 No No No

commands.MediaPrevTrack 58 79 57 45 No No No

commands.MediaStop 58 79 57 45 No No No

Secondary modifier other than Shift


No No 63 No 14 No 15

commands._execute_action 88 88 91 74 15.4 No 15.4

commands._execute_browser_action 25 79 52 15 14 No 15

commands._execute_page_action 25 79 48 15 14 No 15

commands._execute_sidebar_action
No No 54 No No No No

commands.global
58 79 No 45 No No No

content_scripts 54 14 48 41 14 48 15

content_scripts.all_frames
72 14 48 60 14 48 15

content_scripts.css
72 14 48 60 14 48 15

content_scripts.css_origin
No No No No 18 No 18

content_scripts.exclude_globs 72 14 48 60 No 48 No

content_scripts.exclude_matches
72 14 48 60 14 48 15

content_scripts.include_globs 72 14 48 60 No 48 No

content_scripts.js
72 14 48 60 14 48 15

content_scripts.match_about_blank 58 14 52 45 No 52 No

content_scripts.match_origin_as_fallback 99 99 128 85 No 128 No

content_scripts.matches
72 14 48 60 14 48 15

content_scripts.run_at 72 14 48 60 14 48 15

content_scripts.world
111 111 128 97 18 128 18

content_security_policy 58 79 48 45 14 48 15

content_security_policy.extension_pages 88 88 72 74 15.4 79 15.4

content_security_policy.sandbox
88 88 No 74 No No No

declarative_net_request
84 84 113 70 15 113 15

declarative_net_request.rule_resources
84 84 113 70 15 113 15

rule_resources.enabled
84 84 113 70 15 113 15

rule_resources.id
84 84 113 70 15 113 15

rule_resources.path
84 84 113 70 15 113 15

default_locale
54 14 48 41 14 48 15

description
54 14 48 41 14 48 15

developer
No No 52 45 No 52 No

devtools_page
58 79 54 45 16 No No

dictionaries
No No 61 No No 61 No

externally_connectable 67 79 No 54 15.4 No 15.4

homepage_url 54 79 48 41 14 48 15

host_permissions 88 88 109 74 15.4 109 15.4

icons
54 79 48 41 14 48 15

SVG icons
No No 92 No 16.4 92 16.4

incognito
58 18 48 45 14 48 14

incognito.not_allowed
58 17 67 45 14 67 14

incognito.spanning
72 18 48 60 14 48 14

incognito.split
58 17 127 45 14 127 14

manifest_version
4 14 48 15 14 48 15

Version 2
21 14 48 15 14 48 15

Version 3
88 88 109 No 15.4 109 15.4

name
54 14 48 41 14 48 15

offline_enabled
72 79 No 60 No No No

omnibox
58 79 52 45 No No No

omnibox.keyword
72 79 52 60 No No No

optional_host_permissions 102 102 128 88 15.5 128 15.5

optional_permissions
18 79 55 15 14 55 15

optional_permissions.activeTab
26 79 55 15 14 55 15

optional_permissions.alarms
22 79 No 15 No No No

optional_permissions.background
18 79 No 15 No No No

optional_permissions.bookmarks
18 79 55 15 No No No

optional_permissions.browserSettings
No No 57 No No 57 No

optional_permissions.browsingData
19 79 77 15 No No No

optional_permissions.clipboardRead
18 79 55 15 No 55 No

optional_permissions.clipboardWrite
18 79 55 15 14 55 15

optional_permissions.contentSettings
18 79 No 15 No No No

optional_permissions.contextMenus 18 79 55 15 14 55 No

optional_permissions.cookies
18 79 55 15 14 55 15

optional_permissions.declarativeNetRequest
No No No No 15 No 15

optional_permissions.declarativeNetRequestFeedback 84 84 113 70 15.4 113 15.4

optional_permissions.declarativeNetRequestWithHostAccess
96 96 No 82 16 No 16

optional_permissions.devtools
No No 77 No No No No

optional_permissions.dns Canary No No No No No No

optional_permissions.downloads
31 79 60 18 No 60 No

downloads.open
31 79 60 18 No 60 No

optional_permissions.find
No No 57 No No No No

optional_permissions.geolocation
No No 55 No No 55 No

optional_permissions.history
18 79 55 15 No No No

optional_permissions.identity
29 79 No 16 No No No

optional_permissions.idle
18 79 55 15 No 55 No

optional_permissions.management
18 79 77 15 No No No

optional_permissions.menus No No 55 No 14 No No

optional_permissions.nativeMessaging
29 79 87 16 14 No 15

optional_permissions.notifications
18 79 55 15 No 55 No

optional_permissions.pageCapture
18 79 No 15 No No No

optional_permissions.pkcs11
No No 77 No No No No

optional_permissions.privacy
19 79 75 15 No No No

optional_permissions.proxy
No No 77 No No No No

optional_permissions.scripting 88 88 102 No 15.4 102 15.4

optional_permissions.search
87 87 63 73 No 63 No

optional_permissions.sessions
37 79 77 24 No No No

optional_permissions.storage
18 79 No 15 14 No 15

optional_permissions.tabHide
No No 61 No No No No

optional_permissions.tabs
18 79 55 15 14 55 15

optional_permissions.topSites
19 79 55 15 No 55 No

optional_permissions.unlimitedStorage 18 79 No 15 16 No 16

optional_permissions.webNavigation
18 79 55 15 14 55 15

optional_permissions.webRequest
18 79 55 15 14 55 No

optional_permissions.webRequestBlocking
18 79 55 15 No 55 No

optional_permissions.webRequestFilterResponse
No No 110 No No 110 No

webRequestFilterResponse.serviceWorkerScript
No No 95 No No 95 No

options_page
65 14 126 15 14 126 15

options_ui
40 79 48 27 14 57 15

options_ui.browser_style No No 55 No No No No

options_ui.open_in_tab 40 79 48 No No 57 No

options_ui.page
40 79 48 27 14 57 15

page_action 54 14 48 41 14 57 15

page_action.browser_style No No 48 No No No No

page_action.default_icon 72 14 48 60 16.4 57 16.4

page_action.default_popup
72 14 48 60 14 57 15

page_action.default_title
72 14 48 60 14 57 15

page_action.hide_matches
No No 59 No No 59 No

page_action.pinned
No No 64 No No No No

page_action.show_matches
No No 59 No No 79 No

permissions
10 14 48 15 14 48 15

permissions.activeTab
58 79 48 45 14 48 15

permissions.alarms
64 79 48 51 14 48 15

permissions.background
10 79 No No No No No

permissions.bookmarks
64 15 48 51 No No No

permissions.browserSettings
No No 56 No No 56 No

permissions.browsingData 64 79 53 51 No 85 No

permissions.captivePortal
No No 68 No No No No

permissions.clipboardRead
58 79 54 45 No 54 No

permissions.clipboardWrite
58 79 51 45 14 51 15

permissions.contentSettings
64 79 No 51 No No No

permissions.contextMenus 64 14 55 51 14 No No

permissions.contextualIdentities
No No 53 No No 53 No

permissions.cookies
64 14 48 51 14 48 15

permissions.debugger
64 79 No 51 No No No

permissions.declarativeNetRequest
84 84 113 70 15 113 15

permissions.declarativeNetRequestFeedback 84 84 113 70 15.4 113 15.4

permissions.declarativeNetRequestWithHostAccess
84 84 113 70 16 113 16

permissions.devtools
No No 77 No 16 No 16

permissions.dns Canary No 60 No No 60 No

permissions.downloads
64 79 48 51 No 48 No

downloads.open
64 79 48 51 No 48 No

permissions.find
No No 57 No No No No

permissions.geolocation
58 14 54 45 No 54 No

permissions.history
64 79 49 51 No No No

permissions.identity
64 79 53 51 No No No

permissions.idle
64 15 48 51 No 48 No

permissions.management
64 79 51 51 No 51 No

permissions.menus No No 53 No 14 No No

permissions.nativeMessaging
29 15 50 16 14 No 15

permissions.notifications
5 79 48 25 No 48 No

permissions.pageCapture
64 79 No 51 No No No

permissions.pkcs11
No No 58 No No No No

permissions.privacy
64 79 54 51 No 54 No

permissions.proxy
33 79 55 No No 55 No

permissions.scripting 88 88 102 No 15.4 102 15.4

permissions.search
No No 63 No No No No

permissions.sessions
64 79 52 51 No No No

permissions.storage
64 14 48 51 14 48 15

permissions.tabHide
No No 61 No No No No

permissions.tabs
64 14 48 51 14 54 15

permissions.theme
No No 55 No No No No

permissions.topSites
64 79 52 51 No 52 No

permissions.unlimitedStorage 58 14 56 No 16 56 16

permissions.webNavigation
64 14 48 17 14 48 15

permissions.webRequest
64 14 48 51 14 48 No

permissions.webRequestAuthProvider
108 108 126 94 No 126 No

permissions.webRequestBlocking 17 14 48 15 No 48 No

permissions.webRequestFilterResponse
No No 110 No No 110 No

webRequestFilterResponse.serviceWorkerScript
No No 95 No No 95 No

protocol_handlers
No No 54 No No 54 No

protocol_handlers.dat
No No 59 No No 59 No

protocol_handlers.dweb
No No 59 No No 59 No

protocol_handlers.ftp
No No 88 No No 88 No

protocol_handlers.gopher
No No 56 No No 56 No

protocol_handlers.ipfs
No No 59 No No 59 No

protocol_handlers.ipns
No No 59 No No 59 No

protocol_handlers.matrix
No No 90 No No 90 No

protocol_handlers.ssb
No No 59 No No 59 No

short_name
54 14 48 41 14 48 15

sidebar_action
No No 54 30 No No No

sidebar_action.browser_style No No 55 No No No No

sidebar_action.default_icon No No 54 30 No No No

sidebar_action.default_panel
No No 54 30 No No No

sidebar_action.default_title
No No 54 30 No No No

sidebar_action.open_at_install
No No 62 No No No No

storage
80 79 No No 14 No 15

storage.managed_schema 80 79 No No No No No

theme
59 79 55 No No No No

theme.colors
61 79 55 No No No No

colors.bookmark_text 62 79 58 No No No No

colors.button_background_active
No No 60 No No No No

colors.button_background_hover
No No 60 No No No No

colors.frame 61 79 55 No No No No

colors.frame_inactive 62 79 60 No No No No

colors.frame_incognito 62 79 No No No No No

colors.frame_incognito_inactive 62 79 No No No No No

colors.icons
No No 60 No No No No

colors.icons_attention
No No 60 No No No No

colors.ntp_background 62 79 63 No No No No

colors.ntp_header 62 79 No No No No No

colors.ntp_link 62 79 No No No No No

colors.ntp_text 62 79 63 No No No No

colors.popup
No No 60 No No No No

colors.popup_highlight
No No 61 No No No No

colors.popup_highlight_text
No No 61 No No No No

colors.popup_text
No No 60 No No No No

colors.tab_background_separator No No 62 No No No No

colors.tab_background_text 65 79 59 No No No No

colors.tab_line
No No 60 No No No No

colors.tab_loading
No No 60 No No No No

colors.tab_selected
No No 60 No No No No

colors.tab_text 61 79 55 No No No No

colors.toolbar 61 79 57 No No No No

colors.toolbar_bottom_separator No No 58 No No No No

colors.toolbar_field No No 57 No No No No

colors.toolbar_field_border No No 59 No No No No

colors.toolbar_field_border_focus
No No 61 No No No No

colors.toolbar_field_focus
No No 61 No No No No

colors.toolbar_field_highlight
No No 67 No No No No

colors.toolbar_field_highlight_text
No No 67 No No No No

colors.toolbar_field_separator No No 59 No No No No

colors.toolbar_field_text No No 57 No No No No

colors.toolbar_field_text_focus
No No 61 No No No No

colors.toolbar_text No No 57 No No No No

colors.toolbar_top_separator No No 58 No No No No

colors.toolbar_vertical_separator No No 58 No No No No

theme.images 67 79 55 No No No No

images.additional_backgrounds
No No 55 No No No No

images.theme_frame
76 79 55 No No No No

theme.properties
67 79 55 No No No No

properties.color_scheme
No No 100 No No No No

properties.content_color_scheme
No No 100 No No No No

theme_experiment
No No 63 No No No No

theme_experiment.colors
No No 63 No No No No

theme_experiment.images
No No 63 No No No No

theme_experiment.properties
No No 63 No No No No

user_scripts
78 79 68 No No 68 No

user_scripts.api_script
78 79 68 No No 68 No

version 54 14 48 41 14 48 15

version_name
65 79 No 52 14 No 15

web_accessible_resources
54 14 48 41 14 48 15

web_accessible_resources.extension_ids
88 88 109 74 No 109 No

web_accessible_resources.matches
88 88 109 74 15.4 No 15.4

web_accessible_resources.resources
88 88 109 74 15.4 No 15.4

web_accessible_resources.use_dynamic_url 88 88 No 74 No No No

Tip: you can click/tap on a cell for more information.


Full support Partial support In development. Supported in a pre-release version. No support
See implementation notes. Uses a non-standard name. Has more compatibility info.

For a full overview of all manifest keys and their sub-keys, see the full manifest.json browser
compatibility table.

See also
permissions JavaScript API

Help improve MDN


Was this page helpful to you?
Yes No
Learn how to contribute.
This page was last modified on Jul 26, 2024 by MDN contributors.
View this page on GitHub • Report a problem with this content

Mozilla ads

MDN Support Our communities Developers


Your blueprint for a better internet. About Product help MDN Community Web Technologies
Blog Report an issue MDN Forum Learn Web Development
Careers MDN Chat MDN Plus
Advertise with us Hacks Blog

Website Privacy Notice Cookies Legal Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.


Portions of this content are ©1998–2024 by individual mozilla.org contributors. Content available under a Creative Commons license.

You might also like