In the Chrome documentation, it states here that in your extension manifest, you should add the following:
{
"name": "My externally connectable extension",
"externally_connectable": {
// Extension and app IDs. If this field is not specified, no
// extensions or apps can connect.
"ids": [
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
],
"matches": [
"https://*.example.com/*",
],
},
}
It then goes on to say that to send a message from your website to your Chrome Extension, you need to pass the Extension ID as the first parameter of the sendMessage function
// The ID of the extension we want to talk to.
var editorExtensionId = "abcdefghijklmnoabcdefhijklmnoabc";
// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditor: url},
function(response) {
if (!response.success)
handleError(url);
});
Here's the issue. When a Chrome Extension is installed, it is given a random ID by Chrome. For example, in my development build, my PC install has a different ID to my macOS install. As such, the extension only works on the platform with the correct ID.
When I upload the extension to the Chrome store, how am I going to know the ID that it gets given in order to define that ID in my extensions manifest file and on my website?