How can Chrome extension background script communi

2020-03-03 03:23发布

Our webapp registers a service worker. We also have a Chrome extension. What we need is to send messages from service worker to the extension without having the webapp open. What is the right approach to do that?

Our current solution is requesting some URL in the service worker and capturing it in the extension's background script using webRequest - chrome.webRequest.onBeforeRequest.addListener. It works but it looks pretty much nonstandardly.

1条回答
迷人小祖宗
2楼-- · 2020-03-03 03:43

(from wOxxOm's comment, since he hates answering anywhere but in comments)

Your solution is as good as any - before more straightforward support is added, as per this feature request.

查看更多
登录 后发表回答