web_extensions / latest / api / notifications.html /

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

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
NotificationOptions
Yes
17
45
?
Yes
No
?
?
48
?
No
?
TemplateType
Yes
17
45
Only the 'basic' type is supported.
?
Yes
Only the 'basic' type is supported.
No
?
?
48
Only the 'basic' type is supported.
?
No
?
clear
28
17
45
?
25
No
?
?
48
?
No
?
create
28
17
45
?
25
No
?
?
48
?
No
?
getAll
29
17
45
?
25
No
?
?
48
?
No
?
onButtonClicked
28
17
No
?
25
No
?
?
No
?
No
?
onClicked
28
17
47
?
25
No
?
?
48
?
No
?
onClosed
28
17
45
?
25
No
?
?
48
?
No
?
onShown
No
No
56
?
No
No
?
?
56
?
No
?
update
28
17
No
?
25
Not supported on macOS.
No
?
?
No
?
No
?

Example extensions

© 2005–2022 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/notifications