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.

On macOS, the notification looks something like this:

Example notification on macOS, located below the system clock, with a bold title reading "Click notification" followed by regular text reading "You clicked https://developer.mozilla.org/en-US/docs/MDN". The notification has the Firefox Nightly logo on the left side, and a link icon on the right.

On Windows, the notification persists in the Action Center until the browser is closed. The notification looks something like this:

Example notification on Windows 10, located above the system clock, with a bold title reading "Click notification" followed by regular text reading "You clicked https://developer.mozilla.org/en-US/docs/MDN". The notification has a small Firefox logo in the top left corner that is followed by "Mozilla Firefox", and a link icon to the left of the primary notification text.

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.

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
notifications
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.appIconMaskUrl
Chrome – Full support
Chrome 38 (Release date: 2014-10-07)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.buttons
Chrome – Full support
Chrome 65 (Release date: 2018-03-06)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – No support
Opera
footnote
footnote Specifying the 'buttons' option will cause an asynchronous error on Opera.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.contextMessage
Chrome – Full support
Chrome 31 (Release date: 2013-11-12)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – No support
Opera
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored, on Opera 18 and above.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.eventTime
Chrome – Full support
Chrome 65 (Release date: 2018-03-06)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – Full support
Opera 52 (Release date: 2018-03-22)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.imageUrl
Chrome – Full support
Chrome 65 (Release date: 2018-03-06)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – No support
Opera
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.isClickable
Chrome – Full support
Chrome 32 (Release date: 2014-01-14)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – No support
Opera
footnote
footnote Setting 'isClickable' to false will cause an asynchronous error on Opera 19 and above. Older Opera versions throw an error synchronously if this options is given.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.items
Chrome – Full support
Chrome 65 (Release date: 2018-03-06)
footnote
footnote On macOS only the first item is shown.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote
footnote On macOS only the first item is shown.
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – No support
Opera
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.priority
Chrome – Full support
Chrome 65 (Release date: 2018-03-06)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – Full support
Opera 52 (Release date: 2018-03-22)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.progress
Chrome – Full support
Chrome 30 (Release date: 2013-10-01)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Opera – No support
Opera
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored, on Opera 17 and above.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored.
Safari on iOS – No support
Safari on iOS
footnote No support
NotificationOptions.requireInteraction
Chrome – Full support
Chrome 50 (Release date: 2016-04-13)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – No support
Opera
footnote
footnote Specifying this option doesn't throw an error, but its value is ignored, on Opera 37 and above.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
TemplateType
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote
footnote Only the 'basic' type is supported.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote
footnote Only the 'basic' type is supported.
Safari on iOS – No support
Safari on iOS
footnote No support
clear
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
create
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
getAll
Chrome – Full support
Chrome 29 (Release date: 2013-08-20)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
onButtonClicked
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
onClicked
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 47 (Release date: 2016-06-07)
footnote Full support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
onClosed
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
onClosed.byUser
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
onShown
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 56 (Release date: 2017-09-28)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 56 (Release date: 2017-09-28)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
update
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote
footnote Not supported on macOS.
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

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