0

I have the following question.

I've written chrome extension and its loaded to browser. Now I want to call one JavaScript function from any page outside the extension scripts (for example: call from server on localhost);

For instance I have that Script in extension:

var jqr= jQuery.noConflict(true);
(function($) {

var cls= { ... };

cls.init = function() {
  var listener = function(event) {
  }
}

var anotherCall= function() {...}

})(jqr);

now I want to call that function from any page outside the extension.

<body>

<script>
function foo(){
     listener({data:"value"}); 
      anotherCall()
}
</script>

<button onclick="foo()">Click me</button>

</body>

it does not work, listener and anotherCall is undefined . How can I do that?

  • There are multiple problems in your script: `CSP`, No reference to `listener` and `anotherCall` – Sudarshan Jan 23 '13 at 15:51
  • and how can I get references of them? –  Jan 23 '13 at 15:59
  • 1
    Possible duplicate of [Can a site invoke a browser extension?](http://stackoverflow.com/questions/10526995/can-a-site-invoke-a-browser-extension/) – apsillers Jan 23 '13 at 17:00

0 Answers0