0

Is is leagal to access the functions defined in the content scripts from outside? say from: 1.console 2.background script 3.another content script Which of these is/are legal? What actually happens when a content script is executed?

I have a function hit() in the content script content_script.js Why can't I access it from the console even after the page is completely loaded?

ant_1618
  • 1,861
  • 4
  • 17
  • 26
  • possible duplicate of [Accessing global object from content script in chrome extension](http://stackoverflow.com/questions/10052259/accessing-global-object-from-content-script-in-chrome-extension) – Cymen Jun 27 '15 at 22:17
  • No my question asks the other way around – ant_1618 Jun 27 '15 at 22:33
  • You can't access it directly. However, you can fire an event on your main page, and have the content script listen for that specific event, and have hit() run when you do. – Brian Jun 28 '15 at 00:31

0 Answers0