新程式碼請使用 Manifest V3 代替 V2。 關於 Manifest V3,請參見 Manifest 檔案格式的副檔名。
若要將 Manifest V2 擴充功能遷移至 Manifest V3,請參見 「將擴充從 Manifest V2 遷移到 V3」。
擴展的 manifest.json格式
以下程式碼顯示了 Manifest V2 套件擴充中所支援 manifest.json 的欄位。
關於每個欄位的參考資訊,請參閱 V2) (Manifest 檔案格式 ,然後點擊欄位上的連結。
{
// Required
"manifest_version": 2,
"name": "My V2 Extension",
"version": "versionString",
// Recommended
"default_locale": "en",
"description": "A plain-text description",
"icons": {...},
// Pick one or none
"browser_action": {...},
"page_action": {...},
// Optional
"action": ...,
"author": ...,
"automation": ...,
"background": {
// If `background` is included, `persistent` is recommended
"persistent": false,
// If `background` is included, `service_worker` is optional
"service_worker": ...
},
"chrome_settings_overrides": {...},
"chrome_url_overrides": {...},
"commands": {...},
"content_capabilities": ...,
"content_scripts": [{...}],
"content_security_policy": "policyString",
"converted_from_user_script": ...,
"current_locale": ...,
"declarative_net_request": ...,
"devtools_page": "devtools.html",
"differential_fingerprint": ...,
"event_rules": [{...}],
"externally_connectable": {
"matches": ["*://*.contoso.com/*"]
},
"file_browser_handlers": [...],
"file_system_provider_capabilities": {
"configurable": true,
"multiple_mounts": true,
"source": "network"
},
"homepage_url": "http://path/to/homepage",
"host_permissions": ...,
"import": [{"id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}],
"incognito": "spanning, split, or not_allowed",
"input_components": ...,
"key": "publicKey",
"minimum_chrome_version": "versionString",
"nacl_modules": [...],
"natively_connectable": ...,
"oauth2": ...,
"offline_enabled": true,
"omnibox": {
"keyword": "aString"
},
"optional_permissions": ["tabs"],
"options_page": "options.html",
"options_ui": {
"chrome_style": true,
"page": "options.html"
},
"permissions": ["tabs"],
"platforms": ...,
"replacement_web_app": ...,
"requirements": {...},
"sandbox": [...],
"short_name": "Short Name",
"storage": {
"managed_schema": "schema.json"
},
"system_indicator": ...,
"tts_engine": {...},
"update_url": "http://path/to/updateInfo.xml",
"version_name": ...,
"web_accessible_resources": [...]
}
另請參閱
- 將擴充功能從 Manifest V2 遷移到 V3
- Manifest 檔案格式 (V3) - Chrome 擴充功能>參考。
- Chrome 擴充功能>參考中的 V2 (Manifest 檔案格式) 。
注意事項
本頁部分內容基於 Google 創作與 分享 的作品,並依 據創用CC 姓名標示 4.0 國際授權條款進行修改。 原始頁面 可在此查閱。
本作品採用 創用CC 姓名標示4.0國際授權條款授權。