1

When extension toolbar icon set via chrome.pageAction.setIcon() the icon reverted to default after tab reload (F5)

In the documentation it says:

If you want to create an icon that isn't always active, use a page action instead of a browser action.

Which suggests that the icon supposed to be persistent.. Am I missing something?

Sample extension:

manifest.json

{
   "background": {
      "persistent": true,
      "scripts": [ "background.js" ]
   },
   "browser_action": {},
   "manifest_version": 2,
   "name": "test",
   "permissions": [ "tabs" ],
   "version": "0.0.1"
}

background.js

chrome.tabs.getSelected( tab =>
{
  chrome.browserAction.setIcon({
    path: "data:image/bmp;base64,Qk0eAAAAAAAAABoAAAAMAAAAAQABAAEAGAAAAP8A", //red square icon
    tabId: tab.id
  });
});
vanowm
  • 9,466
  • 2
  • 21
  • 37

0 Answers0