清单v3 newtab和背景服务工作者:无法建立连接。接收端不存在
我有自己的newtab页面,在加载访问背景服务工作者(进行一些API调用)上
"chrome_url_overrides": {
"newtab": "newtab/newtab.html"
},
"background": {
"service_worker": "background.js"
},
,但如果它是在初始浏览器启动中加载的第一个选项卡。 它给出了这个错误 无法建立联系。接收端不存在
可能是因为NEWTAB脚本比服务工作者听众早启动?
runtime.onMessage.addListener
因为第二个NEWTAB没有给出此错误。如何解决这个问题?
I have my own newtab page which on load access background service worker(making some API calls)
"chrome_url_overrides": {
"newtab": "newtab/newtab.html"
},
"background": {
"service_worker": "background.js"
},
BUT if it is a first tab loaded on the INITIAL browser launch.
It gives this error
Could not establish connection. Receiving end does not exist
Could it be because newtab script is started earlier than service worker listener?
runtime.onMessage.addListener
Because second newtab is not giving this error. How to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论