Display notifications to the user, using the underlying operating system's notification mechanism. Because this API uses the operating system's notification mechanism, the details of how notifications appear and behave may differ according to the operating system and the user's settings.

To use this API you need to have the "notifications" permission.

Types

notifications.NotificationOptions
Defines the content of a notification.
notifications.TemplateType
The type of notification. For example, this defines whether the notification can contain an image.

Functions

notifications.clear()
Clear a specific notification, given its ID.
notifications.create()
Create and display a new notification.
notifications.getAll()
Get all notifications.
notifications.update()
Update a notification.

Events

notifications.onButtonClicked
Fired when the user clicked a button in the notification.
notifications.onClicked
Fired when the user clicked the notification, but not on a button.
notifications.onClosed
Fired when a notification closed, either by the system or because the user dismissed it.
notifications.onShown
Fired immediately after a notification has been shown.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
NotificationOptions Yes No45 *48 * Yes
TemplateType Yes No45 *48 * Yes *
clear Yes No4548 Yes
create Yes No4548 Yes
getAll Yes No4548 Yes
onButtonClicked Yes No No No Yes
onClicked Yes No4748 Yes
onClosed Yes No4548 Yes
onShown No No5656 No
update Yes No No No Yes *

Example extensions

Acknowledgements

This API is based on Chromium's chrome.notifications API.

Document Tags and Contributors

 Contributors to this page: wbamberg, jyotsna17gupta
 Last updated by: wbamberg,