开发者

a simple problem about chrome extension. : )

I am a beginner with chrome extension. In my content开发者_如何学编程_script.js, how can a get an array in Javascript from background.html?


I did it like this: (assuming you have an array foo in background.html)

chrome.extension.getBackgroundPage().foo

But apparently, that only works for things like popup.html, etc. To get data from your background page in a content_script.js file, you need to use:

chrome.extension.connect()

The API docs are here.


you have to use message passing which I am finding a pain to use, but anyway details here

http://code.google.com/chrome/extensions/messaging.html#connect

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜