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
精彩评论