Home > Enterprise >  How to show images on Google Extension
How to show images on Google Extension

Time:12-08

I create a Google Extension just like Google Translator Extension. After I upload my extension to Google, it doesn't show image when I select a word. It works on my local well, but on server I see this message on console enter image description here . Is there a way to fix this issue?

I use React.js and Material UI.

CodePudding user response:

In your manifest.json

Add this line

"web_accessible_resources": [{ "resources": ["your_image_path"], "matches": ["<all_urls>"] }],

then use this image by doing this:

const imageUrl = chrome.runtime.getURL("your_image_path");
imageElement.src = imageUrl;
  • Related