I have a extension which I loaded in google chrome. Now I'm writting a script from which I want to get the extension's id according to the extension's name. In this case, the extension is like a server and my script in java project is the client. I need is to get the id of the extension outside, from external project
1 Answer
Your extension id is supposed to remain static; It should never change, even when developing. You can simply keep a global variable.
var idOfOtherApplication = "ccokanilabejbblhdenlechhcggmopnp";
Getting an extensions id from its name would be unreliable because multiple extensions can have the same name.
To find the id of an extension go to chrome://extensions
. To find the id of the current extension programmatically simply call one of the following:
var idOfThisApplication = chrome.i18n.getMessage("@@extension_id");
var idOfThisApplication = chrome.runtime.id;
Both of these methods require no extra permissions.
-
1This is how to get the id extension within the extension. What I need is to get the id of the extension outside, from external project.– KaterinaMar 13, 2014 at 8:19
-
There is no way to get it programmatically. See my answer for more information on why. Go to
chrome://extensions
to find the id of an extension. All of this was stated in the answer. Please read carefully before making comments. Redundancy!– 0xcaffMar 13, 2014 at 16:00 -
1There is actually a way to get it programmatically, but it is messy. You have to take the .crx file and do a whole bunch of decoding. There are a lot of articles about it now. I'd still avoid doing it, though. stackoverflow.com/questions/16993486/… Also, ty to @0xcaff, that was actually the answer I needed.– MorfieJul 19, 2017 at 18:46