You can now enable the api to send messages directly from a webpage to your extension id
Enable in manifest
"externally_connectable": {
"matches": ["*://*.example.com/*"]
}
Send message from webpage:
chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditor: url},
function(response) {
if (!response.success)
handleError(url);
});
Receive in extension:
chrome.runtime.onMessageExternal.addListener(function(){});
See: https://developer.chrome.com/extensions/messaging#external-webpage