I'm trying to develop a plugin that affects every tab and window in the browser when the browser action is clicked.
This is the code I currently have:
function updateIcon() {
chrome.browserAction.setIcon({path:current});
if (current == "icon-left.png")
{
current = "icon-right.png";
chrome.tabs.executeScript(null, {file: "cursor.js"});
}
else
{
current = "icon-left.png";
chrome.tabs.reload(null);
}
}
Any suggestion?
Thanks
I solved in this way:
chrome.tabs.query({}, function (tabs) {
for (var i = 0; i < tabs.length; i++) {
chrome.tabs.executeScript(tabs[i].id, {file: "cursor.js"});
}
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With