"web_accessible_resources": [ "images/my-image.png" ]
For example, the "beastify" example extension used in the walkthrough tutorial replaces images in a web page with images of some beasts, by setting the
src attribute of any
<img> elements. The images are packaged with the extension, and for the web page to be able to load them, they must be made web accessible.
web_accessible_resources key lists all packaged resources that you want to make available to web pages in this way. You specify them as paths relative to the manifest.json file.
The files will then be available using a URL like: "moz-extension://<extension-id>/<path/to/resource>".
For example, consider an entry like this:
If your extension's ID is
944cfddf-7a95-3c47-bd9a-663b3ce8d699, then this resource will be available at the following URL:
Entries can contain wildcards, for example:
Will also work.
The easiest way to get this URL, though, is to use the
chrome.extension.getURL API, and give it the path relative to manifest.json:
Note that content scripts don't need to be listed as web accessible resources.
Make the file at "images/my-image.png" web accessible.