I am developing a chrome extension that shows notifications.
I am showing the notifications using these functions chrome.browserAction.setBadgeBackgroundColor
and chrome.browserAction.setBadgeText
.
This is what it looks like:
After the user have seen the notifications I want to remove this badge.
I have tried to make it transparent but this was the result:
Can anyone help me how to remove the badge, or if there is another way that makes what I want?
Solution
When writing an empty text, the badge goes away.
Step 1: Open Chrome browser. Step 2: Click on More at the top right corner. Step 3: Click on More tools and then Extensions. Step 4: Click Remove, corresponding to the extension you want to remove.
To remove the badge count, simply set the text as an empty string:
chrome.browserAction.setBadgeText({
'text': '' //an empty string displays nothing!
});
Be aware if you set badge for especially tab to unset the text for this one:
chrome.tab.query({currentWindow: true, active: true}, function(tabs) {
var tab = tabs[0];
chrome.browserAction.setBadgeText({
text: ''
tabId: theTabId
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With