Disable chrome extension icon

I am developing a chrome extension that shows notifications.
I am showing notifications using these functions chrome.browserAction.setBadgeBackgroundColor

and chrome.browserAction.setBadgeText

.
It looks like this:

After the user has seen the notifications, I want to remove this icon.

I tried to make it transparent, but this was the result:

Can someone help me on how to remove the icon, or if there is another way that does what I want?


Solution
When writing blank text, the icon goes away.

+3


source to share


2 answers


To remove the icon counter, just set the text to an empty string:



chrome.browserAction.setBadgeText({
    'text': '' //an empty string displays nothing!
});

      

+4


source


Remember, if you set the icon for a special contribution to disable the text for that:



chrome.tab.query({currentWindow: true, active: true}, function(tabs) {
    var tab = tabs[0];
    chrome.browserAction.setBadgeText({
        text: ''
        tabId: theTabId
    });
});

      

0


source







All Articles