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.
The notification looks the same on all desktop operating systems. Something like:
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
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
NotificationOptions | ChromeFull supportYes | EdgeFull support17 | FirefoxFull support45 | OperaFull supportYes | SafariFull support14 | Firefox for AndroidFull support48 |
NotificationOptions.appIconMaskUrl | ChromeFull supportYes | EdgeFull support79 | FirefoxNo supportNo
| OperaFull supportYes | SafariFull support14 | Firefox for AndroidNo supportNo
|
NotificationOptions.buttons | ChromeFull supportYes | EdgeFull support79 | FirefoxNo supportNo | OperaNo supportNo
| SafariFull support14 | Firefox for AndroidNo supportNo |
NotificationOptions.contextMessage | ChromeFull support31 | EdgeFull support79 | FirefoxNo supportNo
| OperaNo supportNo
| SafariNo supportNo | Firefox for AndroidNo supportNo
|
NotificationOptions.eventTime | ChromeFull supportYes | EdgeFull support79 | FirefoxNo supportNo
| OperaFull supportYes | SafariFull support14 | Firefox for AndroidNo supportNo
|
NotificationOptions.imageUrl | ChromeFull supportYes | EdgeFull support79 | FirefoxNo supportNo
| OperaNo supportNo
| SafariFull support14 | Firefox for AndroidNo supportNo
|
NotificationOptions.isClickable | ChromeFull support32 | EdgeFull support79 | FirefoxNo supportNo
| OperaNo supportNo
| SafariNo supportNo | Firefox for AndroidNo supportNo
|
NotificationOptions.items | ChromeFull supportYes
| EdgeFull support79
| FirefoxNo supportNo
| OperaNo supportNo
| SafariFull support14
| Firefox for AndroidNo supportNo
|
NotificationOptions.priority | ChromeFull supportYes | EdgeFull support79 | FirefoxNo supportNo
| OperaFull supportYes | SafariFull support14 | Firefox for AndroidNo supportNo
|
NotificationOptions.progress | ChromeFull support30 | EdgeFull support79 | FirefoxNo supportNo
| OperaNo supportNo
| SafariNo supportNo | Firefox for AndroidNo supportNo
|
NotificationOptions.requireInteraction | ChromeFull support50 | EdgeFull support79 | FirefoxNo supportNo | OperaNo supportNo
| SafariNo supportNo | Firefox for AndroidNo supportNo |
TemplateType | ChromeFull supportYes | EdgeFull support17 | FirefoxFull support45
| OperaFull supportYes
| SafariFull support14 | Firefox for AndroidFull support48
|
clear | ChromeFull support28 | EdgeFull support17 | FirefoxFull support45 | OperaFull support25 | SafariNo supportNo | Firefox for AndroidFull support48 |
create | ChromeFull support28 | EdgeFull support17 | FirefoxFull support45 | OperaFull support25 | SafariNo supportNo | Firefox for AndroidFull support48 |
getAll | ChromeFull support29 | EdgeFull support17 | FirefoxFull support45 | OperaFull support25 | SafariNo supportNo | Firefox for AndroidFull support48 |
onButtonClicked | ChromeFull support28 | EdgeFull support17 | FirefoxNo supportNo | OperaFull support25 | SafariNo supportNo | Firefox for AndroidNo supportNo |
onClicked | ChromeFull support28 | EdgeFull support17 | FirefoxFull support47 | OperaFull support25 | SafariNo supportNo | Firefox for AndroidFull support48 |
onClosed | ChromeFull support28 | EdgeFull support17 | FirefoxFull support45 | OperaFull support25 | SafariNo supportNo | Firefox for AndroidFull support48 |
onClosed.byUser | ChromeFull supportYes | EdgeFull support79 | FirefoxNo supportNo | OperaFull supportYes | SafariNo supportNo | Firefox for AndroidNo supportNo |
onShown | ChromeNo supportNo | EdgeNo supportNo | FirefoxFull support56 | OperaNo supportNo | SafariNo supportNo | Firefox for AndroidFull support56 |
update | ChromeFull support28 | EdgeFull support17 | FirefoxNo supportNo | OperaFull support25
| SafariNo supportNo | Firefox for AndroidNo supportNo |
Legend
- Full support
- Full support
- No support
- No support
- Non-standard. Check cross-browser support before using.
- Deprecated. Not for use in new websites.
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Example extensions
Acknowledgements
This API is based on Chromium's chrome.notifications
API.