NotificationEvent: action property - Web APIs | MDN

Value

A string.

Examples

js

self.registration.showNotification("New articles available", {
  actions: [{ action: "get", title: "Get now." }],
});

self.addEventListener("notificationclick", (event) => {
  event.notification.close();
  if (event.action === "get") {
    synchronizeReader();
  } else {
    clients.openWindow("/reader");
  }
});

Specifications

Specification
Notifications API
# dom-notification-actions

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.