Skip to content Skip to sidebar Skip to footer

Execute Function On Webpage?

Say a webpage has a function like: function abc (){ return 'abc'; } How would I execute and receive the return value of that function from my extension? I've tried this, no dice:

Solution 1:

I think that if you want to do this without major security holes, you need to be using XPCSafeJSObjectWrapper, but I'm having trouble finding good documentation on it. https://developer.mozilla.org/en/XPConnect_wrappers has a little bit. (It might be that it happens automatically when doing the above, but I'm not sure.)

Solution 2:

I think I've solved my own problem with:

getBrowser().contentWindow.wrappedJSObject.funcFromPage();

Post a Comment for "Execute Function On Webpage?"