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

Chrome Edge Firefox Firefox for Android Opera
NotificationOptions Yes No 45.0 * 48.0 * 33
TemplateType Yes No 45.0 * 48.0 * 33 *
clear Yes No 45.0 48.0 33
create Yes No 45.0 48.0 33
getAll Yes No 45.0 48.0 33
onButtonClicked Yes No No No 33
onClicked Yes No 47.0 48.0 33
onClosed Yes No 45.0 * 48.0 * 33
update Yes No No No 33 *

Chrome incompatibilities

notifications

  • For notifications.create(), with the "basic" type, iconUrl is optional in Firefox. It is required in Chrome.
  • Notifications are cleared immediately when the user clicks on them. This is not the case in Chrome.
  • If you call notifications.create() more than once in rapid succession, Firefox may end up not displaying any notification at all. Waiting to make subsequent calls until within the chrome.notifications.create() callback function is not a sufficiently long delay to prevent this from happening.

Example add-ons

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

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