Getting the current extension's ID?

5,453 views
Skip to first unread message

Julien Genestoux

unread,
Apr 20, 2011, 8:54:48 AM4/20/11
to chromium-...@chromium.org
Hey,

Is there a convenient way to get either the current extension object (from a backhround page), or the id?
Right now, I use chrome.extension.getURL("/") and then extract the URI, but that's quite a hack. Also, I could hard code this, but I don't think it's good practice... so, any other solution?
Thanks!

julien


Mihai Parparita

unread,
Apr 20, 2011, 11:52:17 AM4/20/11
to Julien Genestoux, chromium-...@chromium.org
There is an @@extension_id predefined message, see
http://code.google.com/chrome/extensions/i18n.html#overview-predefined
for more information.

Mihai

> --
> 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.
>

Julien Genestoux

unread,
Apr 29, 2011, 4:00:10 AM4/29/11
to Mihai Parparita, chromium-...@chromium.org
Thanks Mihai,
That was perfect :)

gark...@gmail.com

unread,
Jun 9, 2013, 4:31:47 PM6/9/13
to chromium-...@chromium.org, julien.g...@gmail.com
This old wrong answer was in top of google search results, so ill do a little necro.
You must use chrome.runtime.id for this purposes, as described in docs:
http://developer.chrome.com/extensions/runtime.html#property-id
uu
Reply all
Reply to author
Forward
0 new messages