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

ChromeEdgeFirefoxFirefox for AndroidOpera
NotificationOptionsYesNo45 *48 *Yes
TemplateTypeYesNo45 *48 *Yes *
clearYesNo4548Yes
createYesNo4548Yes
getAllYesNo4548Yes
onButtonClickedYesNoNoNoYes
onClickedYesNo4748Yes
onClosedYesNo45 *48 *Yes
updateYesNoNoNoYes *

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 extensions

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,