manifest.json
=============

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

List of manifest.json keys
--------------------------

These are the `manifest.json` keys; these keys are available in Manifest V2 and above unless otherwise noted:

* action (Manifest V3 and above)
* author
* background
* browser\_action (Manifest V2 only)
* browser\_specific\_settings
* chrome\_settings\_overrides
* 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\_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": "addon@example.com",
      "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": "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",

  "user\_scripts": {
    "api\_script": "apiscript.js"
  },

  "web\_accessible\_resources": ["images/my-image.png"]
}
```

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

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