__MSG_@@extension_id__

1,239 views
Skip to first unread message

Chrome786

unread,
Jan 14, 2011, 3:16:40 PM1/14/11
to Chromium-extensions
Hi,
 
If I use __MSG_@@extension_id__ in my local css file (which resides in extension folder) it works. I am trying to use __MSG_@@extension_id__ in my local html file to load some png files but seems like it doesn't work. Can I use__MSG_@@extension_id__ in my html files?
 
here is my sample code of html
 
<img src="chrome-extension://__MSG_@@extension_id__/Test.png" alt="Sample" />
 
Thanks,
-Syed

Mohamed Mansour

unread,
Jan 14, 2011, 3:27:42 PM1/14/11
to Chrome786, Chromium-extensions
In your JavaScript file, within the script tag, use http://code.google.com/chrome/extensions/extension.html#method-getURL

Therefore in Javascript, set the src of the Image:

chrome.extensions.getURL('Test.png')

Kind regards,
Mohamed Mansour



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.

PhistucK

unread,
Jan 14, 2011, 3:35:42 PM1/14/11
to Chrome786, Chromium-extensions
No, you cannot.
It only works within CSS.
You can use chrome.extension.getURL("filename.png") in JavaScript to get the full URL to a file within your extension.

PhistucK



--

Chrome786

unread,
Jan 14, 2011, 4:37:52 PM1/14/11
to PhistucK, Chromium-extensions
Thank you guys!!!
Reply all
Reply to author
Forward
0 new messages