Reputation: 364
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
Upvotes: 2
Views: 5310
Reputation: 13681
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.
Upvotes: 5