Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ManifestV3: "invalid value for web_accessible_resources" or "resources must be listed" errors

This is my first attempt writing a Chrome extension. I added "web_accessible_resources": ["images/icon.png"] to manifest.json because I wanted to access the image from content script. After adding this line, I got the error "Invalid value for 'web_accessible_resources[0]'. Could not load manifest." I have checked to make sure the file path is correct, where else could I be wrong? Any help is appreciated.

{
    "name": "Bookmark Checker",
    "version": "1.0",
    "manifest_version": 3,
    "permissions": [
        "bookmarks",
        "activeTab"
    ],
    "background": {
        "service_worker": "background.js"
    },
    "content_scripts": [
        {
            "matches":["https://www.google.com/search?*"],
            "js": ["content/content.js"]
        }
    ],
    ...
    "web_accessible_resources": ["images/icon.png"]
}
like image 332
chau-phan Avatar asked Feb 13 '21 23:02

chau-phan


1 Answers

The syntax for web_accessible_resources in Manifest V3 has changed:

"web_accessible_resources": [{ 
  "resources": ["/images/icon.png"],
  "matches": ["<all_urls>"]
}]

The matches key must specify where to expose these resources since Chrome 89.

like image 68
chau-phan Avatar answered Sep 16 '22 11:09

chau-phan