Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable chrome extension's badge

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.

like image 843
moutaz samir Avatar asked Aug 08 '15 11:08

moutaz samir


People also ask

How do I disable Symantec extension in Chrome?

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.


2 Answers

To remove the badge count, simply set the text as an empty string:

chrome.browserAction.setBadgeText({
    'text': '' //an empty string displays nothing!
});
like image 125
ᔕᖺᘎᕊ Avatar answered Oct 23 '22 23:10

ᔕᖺᘎᕊ


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
    });
});
like image 1
Jean-Luc Barat Avatar answered Oct 24 '22 00:10

Jean-Luc Barat