Google Chrome Extensions v3 - Error in event handler: ReferenceError: Image is not defined

Viewed 1564

I try to create a chrome extension with Manifest v3. When creating a notification i need to set an iconUrl. The icon is "48.png" and it is with the manifest.json in the root folder.

Instead of my notification i get an error:

Error in event handler: ReferenceError: Image is not defined

In v3 they changed the web_accessable_resources definition. I think im setting it wrong but it could also be something else..

My Manifest.json

{
  "name": "Hello Extensions",
  "description":
  "Shows off desktop notifications, which are \"toast\" windows that pop up on the desktop.",
  "version": "1.0",
  "icons": {"16": "16.png", "48": "48.png", "128": "128.png"},
  "permissions": ["alarms","storage", "notifications"],
  "background": {"service_worker": "background.js"},
  "manifest_version": 3,
  "web_accessible_resources": [{
    "resources": ["48.png"],
    "matches": [],
    "extension_ids": [],
    "use_dynamic_url": false
  }]
}

My background.js

chrome.runtime.onInstalled.addListener(function() {
    var options = {
        title: "Title",
        message: "Message goes here",
        type: "basic",
        iconUrl: "48.png"
    };

    return chrome.notifications.create("", options, function() {});
});
0 Answers
Related