Chrome扩展:尽管在清单文件中指定了扩展徽标图像,但未显示或加载

crcmnpdw  于 2023-06-19  发布在  Go
关注(0)|答案(1)|浏览(146)

我点击https://chrome://extensions中的x1c 0d1x按钮,它会加载我的扩展。然而,扩展的图像/徽标是默认的,而不是我提供的:

manifest.js

{
  "name": "My App",
  "version": "1.0.0",
  "description": "My extension doesn't do anything yet!",
  "manifest_version": 2,
  "background": {
    "persistent": false,
    "scripts": ["js/clear_history.js"]
  },
  "icons": {
    "48": "images/logo.svg",
    "96": "images/logo.svg"
  },
  "browser_action": {
    "default_icon": "images/logo.svg"
  },
  "options_ui": {
    "page": "options.html",
    "chrome_style": true
  },
  "permissions": ["history", "storage"],
  "web_accessible_resources": ["logo.svg"]

}

项目目录:

我该怎么解决?

编辑:

ru9i0ody

ru9i0ody1#

不支持WebP和SVG文件。

查看https://developer.chrome.com/docs/extensions/mv3/manifest/icons/
您需要将其转换为.png.jpg文件。

V3用户

manifest.json应该修改。下面是我的例子。

{
  "manifest_version": 3,
  
  // ...
  
  "web_accessible_resources": [
    {
      "resources": [
        "images/*" // <---------- location of your image path
      ],
      "matches": [
        "<all_urls>"
      ]
    }
  ],
}

相关问题