5

I tried to look for this in the chrome documentation but I didn't see anything, especially in the "Security" section in the chrome.tabs documentation. The typical approach in examples I've seen is to send a message to the background page. The background page then calls chrome.tabs.executeScript(). If I can do it from the content script that would be a little easier.

razlebe
  • 7,134
  • 6
  • 42
  • 57
void.pointer
  • 24,859
  • 31
  • 132
  • 243

1 Answers1

6

Content scripts cannot call any Chrome API methods except couple from chrome.extension.* package.

Unless you are doing this to save content script filesize, why not just have that code you are planning to execute in a content script from the beginning?

serg
  • 109,619
  • 77
  • 317
  • 330
  • How do you know this? Is it documented somewhere, or did you just learn from trial & error? – void.pointer Jun 01 '11 at 18:52
  • @Robert Know that scripts cannot call api? It is stated here: http://code.google.com/chrome/extensions/dev/content_scripts.html You can also do `console.log(chrome)` from a content script to see what's available. – serg Jun 01 '11 at 19:02