MDN wants to talk to developers like you: https://qsurvey.mozilla.com/s3/8d22564490d8

The manifest.json file is a JSON-formatted file, and is the only file that every WebExtension 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:

 

"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

ChromeEdgeFirefoxFirefox for AndroidOpera
applicationsNoNo4848No
authorYesYes *5252Yes
backgroundYesYes *48 *48 *Yes
browser_actionYes *Yes *48 *NoYes *
chrome_settings_overridesYesNo55 *55 *Yes
chrome_url_overridesYes *No54 *54 *Yes *
commandsYes *No48 *NoYes *
content_scriptsYes *Yes48 *48 *Yes *
content_security_policyYesYes *48 *48 *Yes
default_localeYesYes4848Yes
descriptionYesYes4848Yes
developerYesNo4848Yes
devtools_pageYesNo54NoYes
homepage_urlYesNo4848Yes
iconsYesYes4848Yes
manifest_versionYesYes4848Yes
nameYesYes4848Yes
omniboxYesNo52NoYes
options_uiYesNo52 *NoYes
page_actionYes *Yes *48NoYes *
permissionsYesYes *48 *48 *Yes
protocol_handlersNoNo5454No
short_nameYesYes4848Yes
sidebar_actionNoNo54NoYes
versionYes *Yes4848Yes
web_accessible_resourcesYesYes4848Yes

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

 Contributors to this page: wbamberg, timdream, 22samuelk, Makyen, Standard8, evilpie, erxin, kmaglione
 Last updated by: wbamberg,