본 사이트는 여러분의 사용자 경험을 개선하기 위해 유지 보수를 진행하는 동안 기능이 제한됩니다. 도움말로 문제가 해결되지 않고 질문을 하고 싶다면 Twitter의 @FirefoxSupport 및 Reddit의 /r/firefox 채널을 활용하세요.

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

Can't load images on extension

  • 2 답장
  • 1 이 문제를 만남
  • 5 보기
  • 최종 답변자: Leagon

more options

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)

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)

more options

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/

more options

선택된 해결법

Nevemind, solved it by using document.body.style.backgroundImage = "url('" + browser.extension.getURL("image.png") + "')";