该页面翻译自 Google Chrome Extensions 与 Google Chrome Apps。除非特别说明,该页面的内容遵循 Creative Commons Attribution 3.0 License,代码示例遵循 BSD License。
每一个扩展程序、可安装的网络应用以及主题背景都有一个
JSON 格式的清单文件,名为
manifest.json
,提供重要信息。
如下代码展示了支持的清单文件字段,以及讨论每一个字段的链接。只有 name 和 version 字段是必需的。
{ // 必选 "app": { "background": { // 可选 "scripts": ["background.js"] } }, "manifest_version": 2, "name": "我的应用", "version": "版本字符串", // 推荐 "default_locale": "en", "description": "纯文本描述", "icons": {...}, // 可选 "author": ..., "commands": { "global": ... }, "current_locale": ..., "display_in_launcher": ..., "display_in_new_tab_page": ..., "externally_connectable": { "matches": ["*://*.example.com/*"] }, "file_handlers": {...}, "import": ..., "key": "公钥", "kiosk_enabled": true, "kiosk_only": true, "media_galleries_handlers": ..., "minimum_chrome_version": "版本字符串", "nacl_modules": [...], "oauth2": ..., "offline_enabled": true, "optional_permissions": ..., "permissions": [...], "platforms": ..., "requirements": {...}, "sandbox": [...], "short_name": "短名称", "signature": ..., "sockets": ..., "storage": { "managed_schema": "schema.json" }, "system_indicator": ..., "update_url": "http://path/to/updateInfo.xml", "url_handlers": {...}, "webview": ... }