According to the docs, the extension id should be the first parameter when calling sendMessage()
. You simply omitted this param.
The second problem is that messages from external web page can receive only the background script. Check the docs for onMessageExternal()
.
Use this code to send a message to your background extension script:
// The ID of my chrome extension (In developer mode)
var editorExtensionId = "cjgeckgdpfhnedenpkaanpehddchlkle";
// Send a message
chrome.runtime.sendMessage(editorExtensionId, "Hello");