Plugins 为Google Chrome开发的扩展之间的通信

Plugins 为Google Chrome开发的扩展之间的通信,plugins,google-chrome,google-chrome-extension,Plugins,Google Chrome,Google Chrome Extension,我为google chrome开发了两个扩展(比如扩展A和扩展B)。扩展A使用Content-scripts.js A,扩展B使用Content-scripts.js B 在content-scripts.jsa中,我使用了localStorage.setItem(“parameterVariable”,“hi”) 在content-scripts.js B中,我使用了localStorage.getItem(“parameterVariable”),它应该返回“hi”,因为扩展A首先运行并设置

我为google chrome开发了两个扩展(比如扩展A和扩展B)。扩展A使用Content-scripts.js A,扩展B使用Content-scripts.js B

在content-scripts.jsa中,我使用了localStorage.setItem(“parameterVariable”,“hi”)

在content-scripts.js B中,我使用了localStorage.getItem(“parameterVariable”),它应该返回“hi”,因为扩展A首先运行并设置“paranetVariable”,而扩展B使用它。但它正在返回空值

如何使扩展B的localStorage.getItem(“parameterVariable”)返回扩展B设置的值

提前感谢。

您可以使用该模块


只需在其中一个扩展上创建一个请求侦听器,在另一个扩展上,向第一个扩展的扩展id发送一个请求。有关消息传递的更多详细信息。

我冒昧地猜测,扩展彼此之间是沙盒式的,因此,wat将是使一个扩展将变量传递给另一个扩展的解决方案。