The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

7. December 2011, 06:32:58

sneakyfildy

Posts: 5

chrome.extension.getURL()

Is there any function in your browser, which acts like the one in subject?
I need to set up css style with image background from content(opera calls'em "injected") script, so I need a link to image, which is in extension files.

7. December 2011, 11:30:24

d4n3

Posts: 957

You can't directly link to image files inside the extension from an injected script. You would need to message the background thread, which would load the image using XHR, convert it into a data: URI (by hardcoding it or using a Canvas) which is then messaged back to the injected script.

See this post.

7. December 2011, 11:35:50

d4n3

Posts: 957

If the images are small and you only need them in your injected script, you could just hardcode the data URIs in your injected script.

You can use an online tool like this one to create the data URIs then just paste them in a string and use them where you see fit.

7. December 2011, 11:43:36

sneakyfildy

Posts: 5

oh, that's nice, thank you.
i need just one texture tile and loading.gif

Forums » Dev.Opera » Opera Extensions Development Discussions