Navigator: clearAppBadge() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
TheclearAppBadge() method of theNavigator interface clears a badge on the current app's icon by setting it tonothing. The valuenothing indicates that no badge is currently set, and the status of the badge iscleared.
In this article
Syntax
js
clearAppBadge()Parameters
None.
Return value
Exceptions
InvalidStateErrorDOMExceptionThrown if the document is not fully active.
SecurityErrorDOMExceptionThrown if the call was blocked by thesame-origin policy.
NotAllowedErrorDOMExceptionThrown if
PermissionStatus.stateis notgranted.
Examples
Once all messages in an application have been read, callclearAppBadge() to clear the badge and remove the notification.
js
navigator.clearAppBadge();Specifications
| Specification |
|---|
| Badging API> # clearappbadge-method> |