how to access a firefox extension variable from the current document/window

Posted by bosky101 on Stack Overflow See other posts from Stack Overflow or by bosky101
Published on 2010-05-14T12:30:51Z Indexed on 2010/05/14 12:34 UTC
Read the original article Hit count: 189

my firefox extension has an object myExt .

myExt = {
 request: function(){ //makes request to server},
 callback: function(json) { //do something with this } 
};

From a dynamically added script element, I make a call to a server that returns json, i want the json to be sent to myExt.callback that exists within my extension's js code.

//from my extension, i add a script element
myExt.request();

//from server i get the following response
myExt.callback ( {"some":"json"}) ;

//but the window doesnt find a reference to myExt

how do i make a reference to myExt variable from the webpage ?

© Stack Overflow or respective owner

Related posts about firefox-addon

Related posts about JavaScript