notifications

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.TemplateType
The type of notification. For example, this defines whether the notification can contain an image.
notifications.NotificationOptions
Defines the content of a notification.

Functions

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

Events

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

Browser compatibility

EdgeFirefoxChromeOpera
NotificationOptions?45.01Yes33
TemplateType?45.03Yes334
clear?45.0Yes33
create?45.0Yes33
getAll?45.0Yes33
onButtonClicked?47.0Yes33
onClicked?47.0Yes33
onClosed?45.06Yes33
update?NoYes338
Firefox
NotificationOptions48.02
TemplateType48.05
clear48.0
create48.0
getAll48.0
onButtonClicked48.0
onClicked48.0
onClosed48.07
updateNo

1. Firefox only supports: type, iconUrl, title, message.
2. Firefox only supports: type, iconUrl, title, message.
3. Firefox only supports the "basic" type.
4. Opera only supports the "basic" type.
5. Firefox only supports the "basic" type.
6. byUser is not supported.
7. byUser is not supported.
8. In Opera update() does not work on Macs.

Chrome incompatibilities

  • Firefox does not support:
    • update()
  • Firefox doesn't provide byUser data.

Example add-ons

Acknowledgements

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

Document Tags and Contributors

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