Skip to content

Notification API

Medium — good to knowFrontend

ELI5 — The Vibe Check

The Notification API lets websites show native system notifications — those little pop-ups in the corner of your screen. The hardest part isn't the API itself, it's convincing users to click 'Allow' on the permission prompt after years of spam sites have traumatized them.

Real Talk

The Notification API displays system-level notifications from web applications. It requires explicit user permission via Notification.requestPermission(). Notifications can include titles, body text, icons, and click actions. For background delivery, combine with Push API and service workers.

Show Me The Code

Notification.requestPermission().then(perm => {
  if (perm === 'granted') {
    new Notification('New message', {
      body: 'You have 3 unread messages',
      icon: '/icon.png'
    });
  }
});

When You'll Hear This

"Don't ask for notification permission on page load — wait until the user does something relevant" / "Combine the Notification API with a service worker for background notifications"

Made with passive-aggressive love by manoga.digital. Powered by Claude.