notifications

OS の通知メカニズムを使って、ユーザーへの通知を表示します。この API は OS の通知メカニズムを使うため、OS とユーザー設定によって通知の現れ方やふるまいは変わってきます。

この API を使うには "notifications" パーミッションが必要です。

すべてのデスクトップ OS で通知は同じ見た目です。次のようなものです:

notifications.NotificationOptions

通知の中身を定義します。

notifications.TemplateType

通知の種類。例えば、通知に画像を含められるかなどを定義します。

関数

notifications.clear()

ID に基づいた特定の通知をクリアします。

notifications.create()

新規の通知を作成、表示します。

notifications.getAll()

すべての通知を取得します。

notifications.update()

通知を更新します。

イベント

notifications.onButtonClicked

ユーザーが通知内のボタンをクリックしたときに発火します。

notifications.onClicked

ユーザーが通知内のボタン以外をクリックしたときに発火します。

notifications.onClosed

通知が閉じたとき、システムかユーザーいずれかがやめた場合にも、発火します。

notifications.onShown

通知が表示されるとすぐに発火します。

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
notifications
NotificationOptions
NotificationOptions.appIconMaskUrl
NotificationOptions.buttons
NotificationOptions.contextMessage
NotificationOptions.eventTime
NotificationOptions.imageUrl
NotificationOptions.isClickable
NotificationOptions.items
NotificationOptions.priority
NotificationOptions.progress
NotificationOptions.requireInteraction
TemplateType
clear
create
getAll
onButtonClicked
onClicked
onClosed
onClosed.byUser
onShown
update

Legend

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

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

Example extensions