I want to know how to insert an image in a Chrome extension.
<img id="image" src="logo.png" />
I'm inserting that html tag correctly into a website, but naturally can't load that logo.png image.
Any ideas on how to modify manifest.json?
I want to know how to insert an image in a Chrome extension.
<img id="image" src="logo.png" />
I'm inserting that html tag correctly into a website, but naturally can't load that logo.png image.
Any ideas on how to modify manifest.json?
The only practical solution I have found is:
<img id="icon" src="./icon.png">
let icon = document.getElementById("icon");
icon.src = chrome.runtime.getURL("icon.png");
"web_accessible_resources": [{
"matches": ["<all_urls>"],
"resources": ["icon.png"]
}]
This solution works for me.
"web_accessible_resources": ["logo.png"] in the manifest.json filesrc='chromeextension://[ID]/images/logo.png' from content.js