Esta página ainda não está disponível em Português, por isso está a ler a versão em inglês.

The Badging API: show a count on your app icon

Unread counts on your app icon, like a native app.

Recursos e APIs Iniciante 1 min de leitura Revisado em 27 de nov. de 2026

The Badging API puts a number, or a dot, on your installed app's icon: in the Windows taskbar, the macOS Dock, the ChromeOS shelf, and the iPhone and iPad Home Screen.

// From a page or the service worker
if ('setAppBadge' in navigator) {
  navigator.setAppBadge(3);      // show 3
  navigator.setAppBadge();       // show a dot (no number)
  navigator.clearAppBadge();     // remove it
}

Where it works

  • Chrome and Edge on Windows, macOS and ChromeOS, for installed apps.
  • Safari on iOS and iPadOS 16.4+ for Home Screen web apps, and on macOS for web apps in the Dock. On Apple platforms the app needs notification permission for badges to show.
  • Not on Android: Android shows notification dots from your notifications instead.

From a push message

The most useful pattern is updating the badge when a push arrives, so it is right even when the app is closed:

self.addEventListener('push', (event) => {
  const data = event.data.json();
  event.waitUntil(Promise.all([
    self.registration.showNotification(data.title, { body: data.body }),
    navigator.setAppBadge?.(data.unread),
  ]));
});

Clear it when the user opens the relevant screen. Keep the number meaningful: unread messages or tasks that need action, not marketing.

Compatibilidade de navegadores

Compatibilidade dos navegadores com recursos de PWA
RecursoChrome / Edge desktopChrome AndroidSafari iOS / iPadOSSafari macOSFirefox desktopFirefox AndroidSamsung Internet
App badge (Badging API) Chrome / Edge desktop: Sim (Installed apps) Chrome Android: Não Safari iOS / iPadOS: Parcial (Home Screen apps with notification permission) Safari macOS: Parcial (Web apps in the Dock) Firefox desktop: Não Firefox Android: Não Samsung Internet: Não

Ver a tabela completa