I was wondering what the difference was between the "default_icon"
property and "icons"
property in the manifest.json
file in Chrome extensions?
{
"name": "Chrome Extension",
"description": "desc",
"version": "1.0.0",
"manifest_version": 3,
"action": {
"default_popup": "index.html",
"default_icon": { // <-- The difference between this...
"16": "favicon-16x16.png",
"32": "favicon-32x32.png",
"64": "favicon-64x64.png"
}
},
"icons": { // <-- ...and this
"16": "favicon-16x16.png",
"32": "favicon-32x32.png",
"64": "favicon-64x64.png"
},
"content_scripts": [{
"css": ["style.css"],
"matches": ["https://www.google.com/*"],
"js": ["script.js"]
}]
}
action.default_icon
is shown in the extension toolbar, next to address bar in the browser. You may show a popup when user clicks the extension icon in toolbar or show quick actions in its context menu.
You may also programmatically update it based on certain events or changes in webpage.
Whereas, the icon specified in icons
is an identifier for your extension. It will be used in the extension details card on chrome://extensions
page and also as favicon for the extension pages.