I can\'t get browser.browserAction.setIcon
to work in Microsoft Edge when manifest.json
is specifying a default icon in multiple sizes:
manifest
In the end I came to the conclusion that Edge doesn't like string
values for the browser action icon path, neither in manifest.json
nor in browserAction.setIcon
, it fails silently without producing any error.
A way to make it work is to always set explicit sizes in both manifest.json
and in every browserAction.setIcon
call, even if the different sizes all point to the same image.
manifest.json
{
"manifest_version": 2,
"name": "test",
"version": "0.0.1",
"author": "John Doe",
"background": {
"scripts": ["background.js"],
"persistent": false
},
"browser_action": {
"default_icon": {
"19": "icon.png",
"38": "icon2.png"
}
}
}
background.js
browser.browserAction.setIcon({
path: {
"19": "testimage.png",
"38": "testimage.png"
});