11

我是扩展开发的新手,
我尝试过使用权限 url,因为 "<all_urls> "*" "http://*/*", "https://*/*" 所有模式都不起作用

完整清单:

{
  "name": "Info",
  "description": "BS System Info",
  "version": "1.0",
  "manifest_version": 3,
  "background": {
    "service_worker": "background.js"
  },
  "content_scripts": [{
    "js": ["script.js"],
    "matches": ["http://*/*","https://*/*","<all_urls>"],
    "css" : []
}],
  "permissions": [
    "storage",
    "activeTab",
    "system.cpu",
    "system.memory",
    "system.storage",
    "system.display",
    "tabs",
    "scripting",
    "http://*/*", "https://*/*", "chrome-devtools://*/*"
],
  "action": {
    "default_popup": "index.html",
    "default_icon": {
        "16": "/images/icon_16.png",
        "32": "/images/icon_32.png",
        "48": "/images/icon_48.png",
        "128":"/images/icon_128.png"
      }
  }
}
4

1 回答 1

25

ManifestV3 中的站点/URL 权限使用单独的密钥:host_permissions

  "host_permissions": [
    "*://*.example.org/"
  ],
  "permissions": [
    "storage"
  ],

官方迁移指南中的更多信息,请务必学习。

于 2021-03-30T08:43:04.097 回答