Chrome extension image resources not showing (manifest version 2)

I just updated the chrome plugin for manifest version 2. I had no problems with permissions related to javascript, but the plugin has some image objects packed with it that no longer appear.

Two specific cases are pop-up notifications when a user interacts with the plugin in certain ways and some small images that the plugin inserts on certain pages. In both cases, images are packaged with the plugin. I have no problem downloading plugins from external resources. My setting of object-src in content_security_policy includes 'self' .

What am I missing? I can open the images if I go to them directly through "chrome-extension: ///some_img.png" so that they are definitely there. I used the webkit inspector and found img that was inserted by right-clicking on img src and opening in a new tab also shows img, so the URLs that are inserted are correct (what they should be, I use chrome.extension.getURL ).

UPDATE:

Setting img-src in content_security_policy also did nothing. I don't know if chrome uses this particular option, but it is in the W3C specification.

+6
source share
1 answer

After scrolling through the change log for the last few versions of chrome, I came across a new (added in Chrome 18) version of the web_accessible_resources manifest . This needs to be added to the manifest with a value that contains a list of strings. Strings are the paths in your directory of resource plugins (imgs, etc.) that you want to be available on web pages (or, importantly, chrome desktop notifications). Adding this parameter to my manifest gave permission to load the necessary images.

+9
source

Source: https://habr.com/ru/post/922313/


All Articles