Notification API
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"
Related Terms
Progressive Web App
A PWA is a website that put on a trench coat and convinced your phone it's a real app.
Push Notification
Push notifications are those little messages that pop up on your phone even when the app is closed.
Web Share API
The Web Share API triggers the native share sheet from a website — the same one native apps use.