Chrome Extension error: “Unchecked runtime.lastError while running browserAction.setIcon: Icon invalid." -
i trying change chrome extension icon dynamically following documentation.
unfortunately, not working following code:
chrome.browseraction.seticon({path: 'my_icon.png'});
in console, failing following error:
unchecked runtime.lasterror while running browseraction.seticon: icon invalid.
after reading elsewhere on web, found need specify images size either (or both) of 19x19 px or 38x38 px.
so resized icon image, , made 2 copies of follows:
- my_icon-19.png
- my_icon-38.png
now when tried following code, worked expected:
chrome.browseraction.seticon({ path: { "19": "/images/my_icon-19.png", "38": "/images/my_icon-38.png" } });
you not need both of versions make work, following work well:
chrome.browseraction.seticon({ path: "/images/my_icon-38.png" });
Comments
Post a Comment