Skip to content

manifest.json Chrome Extension Configuration

manifest.json serves as the primary configuration file for a [[chrome-extension]] (Chrome plugin).^[600-developer__frontend__google__chrome-plugin-develop.md] It is a JSON-formatted file that defines the extension's metadata, structure, and permissions.^[600-developer__frontend__google__chrome-plugin-develop.md]

File Structure

The configuration file must be named manifest.json and placed in the root directory of the extension folder.^[600-developer__frontend__google__chrome-plugin-develop.md]

Core Fields

Metadata

  • manifest_version: Specifies the version of the manifest file format (e.g., 2).^[600-developer__frontend__google__chrome-plugin-develop.md]
  • name: The official name of the extension.^[600-developer__frontend__google__chrome-plugin-develop.md]
  • description: A brief description of the extension's functionality.^[600-developer__frontend__google__chrome-plugin-develop.md]
  • version: The version string of the extension itself (e.g., 1.0.0).^[600-developer__frontend__google__chrome-plugin-develop.md]
  • icons: An object mapping icon sizes (e.g., 16, 48, 128) to image file paths.^[600-developer__frontend__google__chrome-plugin-develop.md]

Browser Action

The browser_action field configures the extension's icon in the Chrome toolbar.^[600-developer__frontend__google__chrome-plugin-develop.md]

  • default_icon: The path to the icon image displayed in the toolbar.^[600-developer__frontend__google__chrome-plugin-develop.md]
  • default_popup: The path to an HTML file (e.g., popup.html) that opens when the user clicks the icon.^[600-developer__frontend__google__chrome-plugin-develop.md]

Permissions

The permissions array declares which Chrome APIs or website access the extension intends to use.^[600-developer__frontend__google__chrome-plugin-develop.md]

  • activeTab: A common permission that allows the extension to access the currently active tab when the user clicks the extension action.^[600-developer__frontend__google__chrome-plugin-develop.md]

Content Scripts

Content scripts are JavaScript files that are injected into web pages matching specific URL patterns.^[600-developer__frontend__google__chrome-plugin-develop.md] They are defined within the content_scripts array, which contains objects with the following properties:

  • matches: An array of URL patterns (e.g., http://*/*, https://*/*) that determine which pages the script runs on.^[600-developer__frontend__google__chrome-plugin-develop.md]
  • js: An array of file paths to be loaded and executed in the matching pages.^[600-developer__frontend__google__chrome-plugin-develop.md] This can include external libraries (e.g., jQuery) or custom scripts.^[600-developer__frontend__google__chrome-plugin-develop.md]

Sources