清单文件格式

每一个扩展程序、可安装的网络应用以及主题背景都有一个 JSON 格式的清单文件,名为 manifest.json,提供重要信息。

字段概述

如下代码展示了支持的清单文件字段,以及讨论每一个字段的链接。只有 nameversion 字段是必需的。

{
  // 必选
  "app": {
    "background": {
      // 可选
      "scripts": ["background.js"]
    },
    "service_worker": {...}
  },
  "manifest_version": 2,
  "name": "我的应用",
  "version": "版本字符串",

  // 推荐
  "default_locale": "en",
  "description": "纯文本描述",
  "icons": {...},

  // 可选
  "author": ...,
  "bluetooth": {
    "uuids": ["1105", "1006"]
  },
  "commands": ...,
  "current_locale": ...,
  "externally_connectable": {
    "matches": ["*://*.example.com/*"]
  },
  "file_handlers": {...},
  "import": ...,
  "key": "公钥",
  "kiosk_enabled": true,
  "kiosk_only": true,
  "minimum_chrome_version": "版本字符串",
  "nacl_modules": [...],
  "oauth2": ...,
  "offline_enabled": true,
  "optional_permissions": ...,
  "permissions": [...],
  "platforms": ...,
  "requirements": {...},
  "sandbox": [...],
  "short_name": "短名称",
  "signature": ...,
  "sockets": {
    "tcp": {
      "connect": "*"
    },
    "udp": {
      "send": "*"
    }
  },
  "storage": {
    "managed_schema": "schema.json"
  },
  "system_indicator": ...,
  "update_url": "http://path/to/updateInfo.xml",
  "url_handlers": {...},
  "webview": {...}
}