Yes, you need to define the image as a web-accessible resource. Add this to your manifest file and you should be good to go!:
"web_accessible_resources": [
"options/smile.jpg"
]
Question
Basically, I am writing an extension that replaces the background image of websites. I use CSS to replace the background image with images in the extension. Here is my style.css:
body {
background-image:url( chrome-extension://moeiggeeiijobkphiljnhlpndjmmpohc/options/smile.jpg ) !important;
}
I don't know why this doesn't work. The url path is correct; if I type it into the address bar, the image smile.jpg will be shown. I also have tried to replace the url with images from other extension that I have installed, like "chrome-extension://pkmbgbnldenjnbgbigpkjokfdfgmmclo/icon-15.png" And it works.
Therefore, I assume that somehow images in my extension can't be accessed by the css. Is there any permission that I need to get?
Solution
Yes, you need to define the image as a web-accessible resource. Add this to your manifest file and you should be good to go!:
"web_accessible_resources": [
"options/smile.jpg"
]