I had a good look, but I cannot find and answer this question (well, nevertheless, it works for me anyway).
I made a Chrome extension that should run code that in my script content only when the icon is clicked, but it always starts as soon as the page loads. Is there any way to prevent this? None of the possible lines that I can enter for run_at is really suitable for this.
Here is sample code in both scenarios:
Script Content:
function runIt() { console.log('working'); } runIt();
background.js:
chrome.browserAction.onClicked.addListener(function(activeTab) { chrome.tabs.executeScript(null, {file: "content.js"}); });
It will record βworkerβ as soon as the page loads, and for each button, click after that. Is there any way to stop it as soon as the page loads?
Thanks in advance for all contributions.
source share