I wrote a chrome extension, and it works properly.
My extension is nothing more than a counter. At the moment, I have to click on the extension icon to see the counter result.
I'd like to have it printed in the bar instead of having to click on an icon to see the result. Is it possible?
I wasn't able to find anything on that, so any help will be really appreciated.
Sorry for not posting here any code, but i don't really think it's necessary for this question.
thanks
The easiest way to do it is to use badges next to the icon.
To set a badge for your extension's icon (assuming it's a Browser Action):
chrome.browserAction.setBadgeText({text: "1"});
chrome.browserAction.setBadgeBackgroundColor({color: [255, 255, 0, 255]}); // RGBA array
chrome.browserAction.setBadgeBackgroundColor({color: "#FFFF00"}); // CSS value
This can also be done per-tab; see the documentation for more info.
If you really want to change your icon, you can draw whatever you want on a <canvas>
element and update your icon with chrome.browserAction.setIcon()
using imageData
format. Here's an example.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments