Notification: maxActions static property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Note: This feature is available in Web Workers.

The maxActions read-only static property of the Notification interface returns the maximum number of actions that can be displayed in a notification.

Value

An integer.

Description

Notification actions are buttons or controls that appear within persistent notifications. Actions are set using the actions option of the second argument of the showNotification() method.

Browsers typically limit the maximum number of actions they will display for a particular notification. The maxActions property returns that limit, which is the maximum number of elements in the Notification.actions array that will be respected by the user agent.

Examples

Log the maximum possible number of actions

The following snippet logs the maximum number of supported actions.

js
const maxActions = Notification.maxActions;
console.log(
  `This device can display at most ${maxActions} actions on each notification.`,
);

Specifications

Specification
Notifications API
# dom-notification-maxactions

Browser compatibility

See also