Can't load images on extension
I'm trying to create an extension that has a menu-like feature, with a "drop-down", which shows more alternatives, however, when I tried to import the image, it didn't work. So I created a "test extension" in which I tried again, in a much more simplified enviroment. However, I don't seem to get this to work (I have included the image in "web_accessible_resources" and used the browser.extension.getURL("image.png"); but It doesn't work), am I doing something wrong, and if so, how are you supposed to do in order to implement images on extensions?
(RenderImage.js): _________________ document.body.style.backgroundImage = browser.extension.getURL("image.png"); _________________ (manifest.json): __________________ {
"manifest_version": 2, "name": "test extension", "version": "1.0",
"web_accessible_resources": [ "image.png" ],
"content_scripts": [ { "matches": [ "http://example.org/" ], "js": [ "RenderImage.js" ] } ]
} ____________________
(I loaded the extension in the temporary load on about:debugging)
선택된 해결법
Nevemind, solved it by using document.body.style.backgroundImage = "url('" + browser.extension.getURL("image.png") + "')";
문맥에 따라 이 답변을 읽어주세요 👍 0모든 댓글 (2)
Hi, just to let you know there are no Developers here just Volunteers. Someone ma know the answer.
You can get help at https://stackoverflow.com/ https://discourse.mozilla.org/c/add-ons and some where in a sub of this : https://www.reddit.com/r/firefox/
선택된 해결법
Nevemind, solved it by using document.body.style.backgroundImage = "url('" + browser.extension.getURL("image.png") + "')";