Hello!
I would like to create an addon that calls js functions on a web page.
The function is defined inside a web page script and I can call it using the firefox console. How do I call the function from the add-on?
Thanks for your help!
Hello!
I would like to create an addon that calls js functions on a web page.
The function is defined inside a web page script and I can call it using the firefox console. How do I call the function from the add-on?
Thanks for your help!
You can interact with the JS from a page using content scripts: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts
Thanks for your help.
I used the content script but I still do not access the functions.
The script is defined in the web page:
//webpage
<script type="text/javascript" src="lib/note.js"></script>
//note.js
var a;
function test() {
.....
}
The addon must call the function “test”.
Can you give me an example?
Thanks.
Hm, I thought this was linked from the content script guide, but I couldn’t see it at a quick glance, so here’s the direct link in case it really wasn’t linked from that article: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Sharing_objects_with_page_scripts#Accessing_page_script_objects_from_content_scripts
Thank you!
it works!