I use this script in the background page to inject script into page and it works well on click on the extension icon
browser.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
browser.tabs.executeScript(tab.id, {
file: 'inject.js'
});
});
I want it to inject the script auto when page load. I used onload and onupdate but not work