Notifications API

Overview

Notifications API allows web apps to show local notifications to the user that are displayed outside the app at the system level, even if the app is idle or in the background.

Notifications API is not meant for Push notifications, which requires server. For Push notifications, you can check Firebase and OneSignal integrations.

Demo

https://nectar.website/demo/web-apis/notifications/

Usage

You can refer to the code present in /partials/web-apis/notifications.html file and use it accordingly.

Using Notifications API requires Service Worker.

The code for handling notifications in present in /www/service-worker.js file, which you can modify as per your needs.

Reference

https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API https://web-push-book.gauntface.com/demos/notification-examples

Last updated