共用方式為


擴充名的清單檔案格式

Microsoft Edge 的每個擴充功能都有一個名為 manifest.json的 JSON 格式清單檔案。 清單檔案就是你擴充功能的藍圖。 清單檔案包含以下資訊:

  • 擴充功能的版本號。
  • 延長的標題。
  • 擴充功能執行所需的權限。

Manifest V2 已被棄用

使用Manifest V3來處理新程式碼。 擴充套件的格式 manifest.json 正從 Manifest V2 移到 Manifest V3。 兩種格式皆在此展示。 若要將 Manifest V2 擴充功能遷移至 Manifest V3,請參見 「將擴充從 Manifest V2 遷移到 V3」。

擴展的 manifest.json格式

以下程式碼顯示了 Manifest V3 或 V2 套件中擴充功能所支援 manifest.json 的欄位。

關於每個欄位的參考資訊,請參閱 Chrome 擴充功能>參考中的 Manifest 檔案格式,然後點擊欄位上的連結。

{
  // Required
  "manifest_version": 3,
  "name": "My V3 Extension",
  "version": "versionString",

  // Recommended
  "action": {...},
  "default_locale": "en",
  "description": "A plain-text description",
  "icons": {...},

  // Optional
  "action": ...,
  "author": ...,
  "automation": ...,
  "background": {
    // If `background` is included, `service_ worker` is required
    "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": ["..."],
  "platforms": ...,
  "replacement_web_app": ...,
  "requirements": {...},
  "sandbox": [...],
  "short_name": "Short Name",
  "side_panel": {...},
  "storage": {
    "managed_schema": "schema.json"
  },
  "system_indicator": ...,
  "tts_engine": {...},
  "update_url": "http://path/to/updateInfo.xml",
  "version_name": "aString",
  "web_accessible_resources": [...]
}

manifest.json V3 與 V2 的變化

V3 V2
"manifest_version": 3, "manifest_version": 2,
"action": {...}, "browser_action": {...},
"action": {...}, "page_action": {...},
已移除 "persistent": false,
background 包含, service_ worker 則是必須的 background 包含 service_ worker ,則為可選
分為兩個不同的調性: "permissions": [...], "host_permissions": [...], "permissions": [...],

另請參閱

注意事項

本頁部分內容基於 Google 創作與 分享 的作品,並依 據創用CC 姓名標示 4.0 國際授權條款進行修改。 原始頁面 可在此查閱。

創用CC授權 本作品採用 創用CC 姓名標示4.0國際授權條款授權。