R
R
raury2021-01-13 17:07:31
JavaScript
raury, 2021-01-13 17:07:31

Is it possible to immediately change the extension icon from the popup script?

I update like this:

chrome.browserAction.setIcon({
  path: {
     "32": `./icons/${this.iconName[state]}`
   }
});

But for some reason, changes occur only after the page is reloaded, although the same code is used in the content script and the icon changes immediately.

Is it possible to instantly update an icon from a popup script?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GrayHorse, 2021-01-13
@raury

Specify tabIdthe tabs for which you want to change the icon, i.e. a new icon must be added manually for each already open tab. Unspecified tabId, it will only be set for new tabs / after a reboot.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question