You can run a content script in all of the pages and listen to the message event. Then the page has to send a message to the same window.
Page -
window.postMessage(JSON.stringify({action: "great-action", value: "great-value}), "*");
Content script -
window.addEventListener("message", function (e) { var details = JSON.parse(e.data); if (details.action === "great-action") { ... } });
Also, there is the other option I mentioned - create a native server that processes requests to localhost via HTTP(S) or WebSocket. The added benefit is that it works in all of the browsers.