W3cubDocs

/Web APIs

Navigator: clearAppBadge() method

The clearAppBadge() method of the Navigator interface clears a badge on the current app's icon by setting it to nothing. The value nothing indicates that no badge is currently set, and the status of the badge is cleared.

Syntax

js

clearAppBadge()

Parameters

None.

Return value

A Promise that resolves with undefined.

Exceptions

NotSupportedError DOMException

Thrown if the Navigator does not have a document that this action can be acted on.

Examples

Once all messages in an application have been read, call clearAppBadge() to clear the badge and remove the notification.

js

navigator.clearAppBadge();

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
clearAppBadge
81Windows and macOS only.
81Windows and macOS only.
No No No
17Badging is supported for installed web apps on macOS Sonoma and higher.
81 81 No 58 16.4 13.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clearAppBadge