【发布时间】:2020-10-25 01:35:06
【问题描述】:
在我的 chrome 扩展中,出于显而易见的原因,我想要一个后台脚本。但是,我现在还想要一个我喜欢的背景页面,这里描述了使用 iFrame 加载一些 html (Chrome extension: loading a hidden page (without iframe)),我可以使用内容脚本与之交互。但是当我尝试像这样加载后台脚本和后台页面时:
...
"background":{
"scripts": ["background_script.js"]
},
"background": {
"page": "iFrameBackground.html",
"persistent": true
},
...
然后尝试从我的内容脚本向后台脚本发送消息,我收到此错误:
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
所以要么我在这里完全遗漏了一些东西,要么你真的只能使用两者之一?
谢谢你:)
【问题讨论】:
标签: javascript google-chrome-extension