Situation:
Inject.js is injected into the page's MAIN world using chrome.scripting.executeScript from background.js
Everything works as expected except when trying to send a message from inject.js back to extension.
The message actually hits the target but always followed by the error
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
// inject.js
chrome.runtime.sendMessage("<extensionId>","Test", (resp => {
console.log(resp);
res("OK");
}));
The same happens when trying the below - any idea why ??
chrome.runtime.connect(<extensionid>,{});
br Morten