Communicate between scripts in the background context (background script, browser action, page action, options page, etc.)

Communicating with a page in the background context Pages which are open in the background context include: background pages/scripts(MDN) event pages (Firefox does not support event pages. All manifest.json background pages remain loaded at all times.) browser action popups(MDN) page action popups(MDN) options pages(MDN1, MDN2) (in a popup, a tab, or window) sidebar action pages … Read more

How to open the correct devtools console to see output from an extension script?

Your code is correct as written, it works and outputs to console. If you are not seeing it, then you are, probably, looking at the wrong console. 1. Firefox Mozilla describes what extension output can be seen in which console in their Debugging article. Browser Console The Browser Console no longer shows output from WebExtensions … Read more

onclick or inline script isn’t working in extension

Chrome Extensions don’t allow you to have inline JavaScript (documentation). The same goes for Firefox WebExtensions (documentation). You are going to have to do something similar to this: Assign an ID to the link (<a onClick=hellYeah(“xxx”)> becomes <a id=”link”>), and use addEventListener to bind the event. Put the following in your popup.js file: document.addEventListener(‘DOMContentLoaded’, function() … Read more