chrome.notifications (original) (raw)

Skip to main content

chrome.notifications

Description

Use the chrome.notifications API to create rich notifications using templates and show these notifications to users in the system tray.

Permissions

notifications

Types

NotificationBitmap

NotificationButton

Properties

NotificationItem

Properties

NotificationOptions

Properties

PermissionLevel

Enum

"granted"
Specifies that the user has elected to show notifications from the app or extension. This is the default at install time.

"denied"
Specifies that the user has elected not to show notifications from the app or extension.

TemplateType

Enum

"basic"
Contains an icon, title, message, expandedMessage, and up to two buttons.

"image"
Contains an icon, title, message, expandedMessage, image, and up to two buttons.

"list"
Contains an icon, title, message, items, and up to two buttons. Users on Mac OS X only see the first item.

"progress"
Contains an icon, title, message, progress, and up to two buttons.

Methods

clear()

chrome.notifications.clear(
  notificationId: string,
): Promise

Clears the specified notification.

Parameters

Returns

create()

chrome.notifications.create(
  notificationId?: string,
  options: NotificationOptions,
): Promise

Creates and displays a notification.

Parameters

Returns

getAll()

chrome.notifications.getAll(): Promise

Retrieves all the notifications of this app or extension.

Returns

getPermissionLevel()

chrome.notifications.getPermissionLevel(): Promise<PermissionLevel>

Retrieves whether the user has enabled notifications from this app or extension.

Returns

update()

chrome.notifications.update(
  notificationId: string,
  options: NotificationOptions,
): Promise

Updates an existing notification.

Parameters

Returns

Events

onButtonClicked

chrome.notifications.onButtonClicked.addListener(
  callback: function,
)

The user pressed a button in the notification.

Parameters

onClicked

chrome.notifications.onClicked.addListener(
  callback: function,
)

The user clicked in a non-button area of the notification.

Parameters

onClosed

chrome.notifications.onClosed.addListener(
  callback: function,
)

The notification closed, either by the system or by user action.

Parameters

onPermissionLevelChanged

chrome.notifications.onPermissionLevelChanged.addListener(
  callback: function,
)

The user changes the permission level. As of Chrome 47, only ChromeOS has UI that dispatches this event.

Parameters

onShowSettings

Deprecated since Chrome 65

chrome.notifications.onShowSettings.addListener(
  callback: function,
)

Custom notification settings button is no longer supported.

The user clicked on a link for the app's notification settings. As of Chrome 47, only ChromeOS has UI that dispatches this event. As of Chrome 65, that UI has been removed from ChromeOS, too.

Parameters

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-11 UTC.