알림 API

현행 표준 — 마지막 업데이트

참여하기:
GitHub whatwg/notifications (새 이슈, 오픈 이슈)
Matrix에서 채팅하기
커밋:
GitHub whatwg/notifications/commits
이 커밋 기준 스냅샷
@notifyapi
테스트:
web-platform-tests notifications/ (진행 중 작업)
번역 (비규범적):
日本語
简体中文
한국어

개요

이 현행 표준은 최상위 브라우징 컨텍스트의 뷰포트 외부에 일반적으로 표시되는 알림을 최종 사용자에게 보여주기 위한 API를 정의합니다. 기존 알림 시스템과 호환되도록 설계되었으며, 플랫폼 독립성을 유지합니다.

1. 용어

이 명세서는 Infra 표준에 의존합니다. [INFRA]

이 명세서에서 사용되는 일부 용어는 DOM, Fetch, High Resolution Time, HTML, IDL, Service Workers, URL, Vibration API 표준에서 정의되어 있습니다. [DOM] [FETCH] [HR-TIME] [HTML] [WEBIDL] [SERVICE-WORKERS] [URL] [VIBRATION]

2. 알림

알림은 메시지 전달과 같이 발생한 어떤 일을 추상적으로 나타낸 것입니다.

알림은 연관된 서비스 워커 등록(null 또는 서비스 워커 등록)을 가집니다. 처음에는 null입니다.

알림은 연관된 제목(문자열)을 가집니다.

알림은 연관된 방향("auto", "ltr", 또는 "rtl")을 가집니다.

알림은 연관된 언어(문자열)을 가집니다.

알림은 연관된 본문(문자열)을 가집니다.

알림은 연관된 네비게이션 URL (null 또는 URL)을 가집니다. 처음에는 null입니다.

알림은 연관된 태그(문자열)을 가집니다.

알림은 연관된 데이터(Record)를 가집니다.

알림은 연관된 타임스탬프 (EpochTimeStamp)를 가집니다.

타임스탬프는 알림이 실제로 발생한 시간을 나타내는 데 사용할 수 있습니다. 예를 들어, 디바이스가 오프라인이어서 메시지를 즉시 전달할 수 없었던 경우에는 과거가 될 수 있고, 곧 시작될 회의 등 미래가 될 수도 있습니다.

알림은 연관된 오리진(origin)을 가집니다.

알림은 연관된 재알림 선호(불리언)을 가집니다. 처음에는 false입니다. true일 때, 알림 표시 단계가 동일한 태그를 가진 기존 알림과 새로운 알림에서 실행된 후 최종 사용자에게 다시 알림을 주어야 함을 나타냅니다.

알림은 연관된 무음 선호(null 또는 불리언)을 가집니다. 처음에는 null입니다. true일 때는 소리나 진동을 발생시키지 않아야 하고, null일 때는 소리나 진동을 발생시킬지 여부를 플랫폼 규칙에 따릅니다.

알림은 연관된 상호작용 요구 선호 (불리언)을 가집니다. 처음에는 false입니다. true일 때는 화면 크기가 충분히 큰 장치에서, 최종 사용자가 알림을 활성화하거나 해제할 때까지 알림이 쉽게 접근 가능해야 함을 나타냅니다.

알림은 다음과 같은 그래픽을 가질 수 있습니다: 이미지 URL, 아이콘 URL, 그리고 배지 URL; 그리고 각각에 대응하는 이미지 리소스, 아이콘 리소스, 배지 리소스.

이미지 리소스알림의 내용 일부로 표시되는 그림이며, 아이콘 리소스배지 리소스보다 시각적으로 우선적으로 표시되어야 하지만, 더 적은 경우에 표시될 수 있습니다.

아이콘 리소스알림을 보강하는 이미지(예: 아이콘, 발신자 사진 등)입니다.

배지 리소스는 웹 애플리케이션이나 알림의 카테고리를 나타내는 아이콘입니다. 웹 애플리케이션이 다양한 알림을 보낼 때 특히 그렇습니다. 공간이 부족해 알림 자체를 표시할 수 없을 때 배지 리소스를 사용할 수 있습니다. 알림 내부에 표시할 수도 있습니다 하지만 이 경우 이미지 리소스아이콘 리소스보다 시각적 우선순위가 낮아야 합니다.

알림은 연관된 진동 패턴(리스트)를 가집니다. 처음에는 « »입니다.

개발자들은 이미지, 아이콘, 배지, 진동 패턴을 통해 최종 사용자에게 접근할 수 없는 정보를 전달하지 않도록 권장합니다. 특히 알림 플랫폼이 이러한 기능을 지원하지 않는 경우 무시될 수 있기 때문입니다.

알림은 연관된 액션(리스트로, 0개 이상의 알림 액션을 가짐). 알림 액션은 최종 사용자를 위한 선택지를 나타냅니다. 각 알림 액션은 다음을 연관합니다:

이름
문자열.
제목
문자열.
네비게이션 URL
null 또는 URL. 처음에는 null입니다.
아이콘 URL
null 또는 URL. 처음에는 null입니다.
아이콘 리소스
null 또는 리소스. 처음에는 null입니다.

사용자는 알림 자체를 활성화하는 것 외에도 액션을 활성화할 수 있습니다. 지원되는 최대 액션 수는 알림 플랫폼의 제약 내에서 0개 이상의 구현 정의 정수입니다.

액션 표시 여부는 플랫폼에 따라 다르므로, 개발자는 최종 사용자가 알림에서 호출할 수 있는 모든 액션을 웹 애플리케이션 내에서도 사용할 수 있도록 하는 것이 좋습니다.

일부 플랫폼에서는 아이콘 리소스를 최종 사용자에게 표시하기 전에 플랫폼의 시각적 스타일에 더 잘 맞게 수정할 수 있습니다. 예를 들어, 모서리를 둥글게 하거나 특정 색상으로 칠할 수 있습니다. 개발자는 그러한 경우에도 정보가 손실되지 않도록(색상 손실, 모서리 잘림 등) 아이콘을 디자인하는 것이 좋습니다.

비지속성 알림알림서비스 워커 등록이 null인 것입니다.

(This is a tracking vector.) 지속성 알림알림서비스 워커 등록이 null이 아닌 것입니다.


문자열 title, NotificationOptions 딕셔너리 options, 그리고 환경 설정 객체 settings으로 설정 객체로 알림 생성을 하려면:

  1. originsettings오리진으로 설정합니다.

  2. baseURLsettingsAPI 기본 URL로 설정합니다.

  3. fallbackTimestampUnix epoch부터 settings현재 실제 시간까지의 밀리초 수(가장 가까운 정수로 반올림)로 설정합니다.

  4. title, options, origin, baseURL, fallbackTimestamp을 인자로 알림 생성의 결과를 반환합니다.

문자열 title, NotificationOptions 딕셔너리 options, origin origin, URL baseURL, EpochTimeStamp fallbackTimestamp알림 생성을 하려면:

  1. notification을 새로운 알림으로 설정합니다.

  2. options["silent"] 가 true이고 options["vibrate"] 존재하면, TypeError를 throw합니다.

  3. options["renotify"] 가 true이고 options["tag"] 가 빈 문자열이면, TypeError를 throw합니다.

  4. notificationdataStructuredSerializeForStorage(options["data"])로 설정합니다.

  5. notification제목title로 설정합니다.

  6. notification방향options["dir"]로 설정합니다.

  7. notification언어options["lang"]로 설정합니다.

  8. notification오리진origin으로 설정합니다.

  9. notification본문options["body"]로 설정합니다.

  10. options["navigate"] 존재하면, baseURL로 파싱하고, 실패가 아니면 notification네비게이션 URL을 그 반환값으로 설정합니다. (실패면 notification네비게이션 URL은 null로 남깁니다.)

  11. notification태그options["tag"]로 설정합니다.

  12. options["image"] 존재하면, baseURL로 파싱하고, 실패가 아니면 notification이미지 URL을 그 반환값으로 설정합니다. (실패면 notification이미지 URL은 설정하지 않습니다.)

  13. options["icon"] 존재하면, baseURL로 파싱하고, 실패가 아니면 notification아이콘 URL을 그 반환값으로 설정합니다. (실패면 notification아이콘 URL은 설정하지 않습니다.)

  14. options["badge"] 존재하면, baseURL로 파싱하고, 실패가 아니면 notification배지 URL을 그 반환값으로 설정합니다. (실패면 notification배지 URL은 설정하지 않습니다.)

  15. options["vibrate"] 존재하면, 검증 및 정규화하고, notification진동 패턴을 그 반환값으로 설정합니다.

  16. options["timestamp"] 존재하면, notification타임스탬프를 그 값으로 설정합니다. 그렇지 않으면 notification타임스탬프fallbackTimestamp로 설정합니다.

  17. notification재알림 선호options["renotify"]로 설정합니다.

  18. notification무음 선호options["silent"]로 설정합니다.

  19. notification상호작용 요구 선호options["requireInteraction"]로 설정합니다.

  20. notification액션을 « »로 설정합니다.

  21. options["actions"]의 각 entry에 대해, 지원되는 최대 액션 수까지(초과 항목은 건너뜀):

    1. action을 새로운 알림 액션으로 설정합니다.

    2. action이름entry["action"]로 설정합니다.

    3. action제목entry["title"]로 설정합니다.

    4. entry["navigate"] 존재하면, baseURL로 파싱하고, 실패가 아니면 action네비게이션 URL을 그 반환값으로 설정합니다. (실패면 action네비게이션 URL은 null로 남깁니다.)

    5. entry["icon"] 존재하면, baseURL로 파싱하고, 실패가 아니면 action아이콘 URL을 그 반환값으로 설정합니다. (실패면 action아이콘 URL은 null로 남깁니다.)

    6. actionnotification액션에 추가합니다.

  22. notification을 반환합니다.

2.1. 수명 및 UI 통합

사용자 에이전트는 알림 목록을 유지해야 하며, 이는 0개 이상의 리스트로 이루어진 알림입니다.

사용자 에이전트는 비지속성 알림이 생성된 후 몇 초 후에 닫기 단계를 실행해야 합니다.

사용자 에이전트는 비지속성 알림을 플랫폼의 "알림 센터"(가능한 경우)에 표시하지 않아야 합니다.

사용자 에이전트는 지속성 알림알림 목록에서 제거될 때까지 계속 유지해야 합니다.

지속성 알림close() 메서드가 해당 Notification 객체 중 하나에서 호출될 수 있습니다.

사용자 에이전트는 지속성 알림을 플랫폼의 "알림 센터"(가능한 경우)에 표시해야 합니다.

2.2. 권한 통합

Notifications API는 강력한 기능이며, 이름 "notifications"로 식별됩니다. [Permissions]

알림 권한 상태 가져오기를 하려면 다음 단계를 실행합니다:

  1. permissionState를 "notifications"로 현재 권한 상태 가져오기의 결과로 설정합니다.

  2. permissionState가 "prompt"이면, "default"를 반환합니다.

  3. permissionState를 반환합니다.

2.3. 방향

이 절은 HTML의 렌더링 섹션에서 사용된 용어와 동등한 용어를 사용하여 작성되었습니다. [HTML]

사용자 에이전트는 알림제목, 본문, 그리고 각 액션제목 텍스트의 Unicode 의미를 준수해야 합니다. 각 항목은 표시될 때 양방향 알고리즘의 규칙 P1, P2, P3에 따라 한 개 이상의 독립적인 양방향 알고리즘 단락으로 처리되어야 하며, 예를 들어 U+000A LINE FEED(LF) 문자의 단락 분할 동작을 지원해야 합니다. 제목, 본문, 그리고 액션 각각의 제목의 각 단락에 대해, 알림방향이 "auto"가 아닌 값을 가지면 상위 규칙 P2, P3를 오버라이드합니다. [BIDI]

알림방향은 또한 알림 플랫폼이 액션을 나란히 표시하는 경우 알림액션들이 최종 사용자에게 표시되는 상대적 순서를 결정합니다.

2.4. 언어

알림언어알림제목, 본문, 그리고 각 액션제목의 기본 언어를 지정합니다. 값은 문자열입니다. 빈 문자열은 기본 언어를 알 수 없음을 나타냅니다. 그 외의 문자열은 언어 태그로 해석되어야 합니다. 유효성 또는 형식은 강제하지 않습니다. [BCP47]

개발자는 유효한 언어 태그만 사용하는 것이 좋습니다.

2.5. 리소스

주어진 알림 notification에 대한 fetch 단계는 다음과 같습니다:

  1. 알림 플랫폼이 이미지를 지원하면, fetch notificationimage URL을, image URL이 설정되어 있을 때 실행합니다.

    이 리소스는 <img>와 유사하게 fetch하는 것이 목적이지만, 추상화가 필요함.

    그리고 나서, 병렬로:

    1. response를 기다립니다.

    2. responseinternal responsetype이 "default"라면, 리소스를 이미지로 디코드 시도합니다.

    3. 이미지 포맷이 지원되면 notification이미지 리소스를 디코드된 리소스로 설정합니다. (지원되지 않으면 notification이미지 리소스를 가지지 않습니다.)

  2. 알림 플랫폼이 아이콘을 지원하면, fetch notificationicon URL을, icon URL 이 설정되어 있을 때 실행합니다.

    이 리소스는 <img>와 유사하게 fetch하는 것이 목적이지만, 추상화가 필요함.

    그리고 나서, 병렬로:

    1. response를 기다립니다.

    2. responseinternal responsetype이 "default"라면, 리소스를 이미지로 디코드 시도합니다.

    3. 이미지 포맷이 지원되면 notification아이콘 리소스를 디코드된 리소스로 설정합니다. (지원되지 않으면 notification아이콘 리소스를 가지지 않습니다.)

  3. 알림 플랫폼이 배지를 지원하면, fetch notificationbadge URL을, badge URL이 설정되어 있을 때 실행합니다.

    이 리소스는 <img>와 유사하게 fetch하는 것이 목적이지만, 추상화가 필요함.

    그리고 나서, 병렬로:

    1. response를 기다립니다.

    2. responseinternal responsetype이 "default"라면, 리소스를 이미지로 디코드 시도합니다.

    3. 이미지 포맷이 지원되면 notification배지 리소스를 디코드된 리소스로 설정합니다. (지원되지 않으면 notification배지 리소스를 가지지 않습니다.)

  4. 알림 플랫폼이 액션 및 액션 아이콘을 지원하면, notification액션 각각에 대해: 아이콘 URL이 null이 아니면 fetch action아이콘 URL을 실행합니다.

    이 리소스는 <img>와 유사하게 fetch하는 것이 목적이지만, 추상화가 필요함.

    그리고 나서, 병렬로:

    1. response를 기다립니다.

    2. responseinternal responsetype이 "default"라면, 리소스를 이미지로 디코드 시도합니다.

    3. 이미지 포맷이 지원되면 action아이콘 리소스를 디코드된 리소스로 설정합니다. (지원되지 않으면 action아이콘 리소스는 null로 남깁니다.)

2.6. 알림 표시

주어진 알림 notification에 대한 알림 표시 단계는 다음과 같습니다:

  1. notification에 대해 fetch 단계를 실행합니다.

  2. 모든 fetch가 완료되고 notification이미지 리소스, 아이콘 리소스, 배지 리소스(있는 경우), 그리고 notification액션아이콘 리소스(있는 경우)가 설정될 때까지 기다립니다.

  3. shown을 false로 설정합니다.

  4. oldNotification알림 목록에서 태그가 빈 문자열이 아니고 notification태그와 같으며, 오리진notification오리진동일 출처알림으로 설정합니다(있으면), 없으면 null로 설정합니다.

  5. oldNotification이 null이 아니면:

    1. oldNotification에 대해 닫기 이벤트 처리를 실행합니다.

    2. 알림 플랫폼이 교체를 지원하면:

      1. 알림 목록에서 oldNotificationnotification으로 교체합니다.

      2. shown을 true로 설정합니다.

      알림 플랫폼은 더 나은 사용자 경험을 위해 네이티브 교체를 지원하는 것이 강하게 권장됩니다.

    3. 그렇지 않으면 알림 목록에서 oldNotification을 제거합니다.

  6. shown이 false이면:

    1. notification알림 목록에 추가합니다.

    2. 기기에서 notification을 표시합니다(예: 알림 플랫폼 API 호출).

  7. shown이 false이거나 oldNotification이 null이 아니고, notification재알림 선호가 true이면, notification에 대해 알림 단계를 실행합니다.

  8. notification비지속성 알림이면, 태스크 큐잉하여 Notification 객체(해당 notification을 나타냄)에 show 이벤트를 발생시킵니다.

2.7. 알림 활성화

최종 사용자가 알림 notification 또는 그 액션 중 하나를 활성화할 때, 해당 알림 플랫폼이 활성화를 지원한다고 가정하고, 사용자 에이전트는(별도 명시가 없으면) 다음 단계를 실행해야 합니다:

  1. action을 null로 설정합니다.

  2. 최종 사용자가 notification액션 중 하나를 활성화했다면, action을 해당 알림 액션으로 설정합니다.

  3. navigationURLnotification네비게이션 URL로 설정합니다.

  4. action이 null이 아니면, navigationURLaction네비게이션 URL로 설정합니다.

    이렇게 하면 알림 액션네비게이션 URL이 null일 때 click 이벤트로 넘어가도록 되어, 웹 개발자에게 더 많은 유연성을 제공합니다.

  5. navigationURL이 null이 아니면:

    1. 다음 두 옵션 중 하나를 구현 정의 방식으로 선택합니다:

      사용자 에이전트는 플랫폼 규칙을 따르는 것이 강력히 권장됩니다.

    2. Return.

  6. notification지속성 알림이면:

    1. actionName을 빈 문자열로 설정합니다.

    2. action이 null이 아니면, actionNameaction이름으로 설정합니다.

    3. 서비스 워커 알림 이벤트 발행 "notificationclick"를 notificationactionName을 넘겨 실행합니다.
  7. 그 외에는, 태스크 큐잉하여 다음 단계를 실행합니다:

    1. intoFocusNotification 객체(해당 notification을 나타냄)에 click 이벤트를 발생시키는 결과로 설정하며, cancelable 속성을 true로 초기화합니다.

      사용자 에이전트는 focus() 를 이벤트 리스너 내에서 동작하도록 하는 것이 권장됩니다.

    2. intoFocus가 true이면, 사용자 에이전트는 notification의 관련 브라우징 컨텍스트 뷰포트를 포커스로 가져와야 합니다.

웹 플랫폼 전체에서 "activate"는 의도적으로 "click"으로 명명되어 있습니다.

2.8. 알림 닫기

알림이 알림 플랫폼이나 최종 사용자에 의해 닫힐 때, 해당 닫기 단계를 실행해야 합니다.

주어진 알림 notification에 대한 닫기 단계는 다음과 같습니다:

  1. 알림 목록notification포함하지 않으면 이 단계들을 중단합니다.

  2. notification에 대해 닫기 이벤트 처리를 실행합니다.

  3. 알림 목록에서 notification을 제거합니다.

알림 notification에 대해 닫기 이벤트 처리를 하려면:

  1. notification지속성 알림이고 최종 사용자에 의해 닫혔다면, 서비스 워커 알림 이벤트 발행 "notificationclose"를 notification으로 실행합니다.

  2. notification비지속성 알림이면, 태스크 큐잉하여 Notification 객체(해당 notification을 나타냄)에 close 이벤트를 발생시킵니다.

2.9. 최종 사용자 알림

최종 사용자에게 주어진 알림 notification을 알릴 때 알림 단계는 다음과 같습니다:

  1. notification진동 패턴(있는 경우)으로 진동 수행을 합니다.

3. API

[Exposed=(Window,Worker)]
interface Notification : EventTarget {
  constructor(DOMString title, optional NotificationOptions options = {});

  static readonly attribute NotificationPermission permission;
  [Exposed=Window] static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback deprecatedCallback);

  static readonly attribute unsigned long maxActions;

  attribute EventHandler onclick;
  attribute EventHandler onshow;
  attribute EventHandler onerror;
  attribute EventHandler onclose;

  readonly attribute DOMString title;
  readonly attribute NotificationDirection dir;
  readonly attribute DOMString lang;
  readonly attribute DOMString body;
  readonly attribute USVString navigate;
  readonly attribute DOMString tag;
  readonly attribute USVString image;
  readonly attribute USVString icon;
  readonly attribute USVString badge;
  [SameObject] readonly attribute FrozenArray<unsigned long> vibrate;
  readonly attribute EpochTimeStamp timestamp;
  readonly attribute boolean renotify;
  readonly attribute boolean? silent;
  readonly attribute boolean requireInteraction;
  [SameObject] readonly attribute any data;
  [SameObject] readonly attribute FrozenArray<NotificationAction> actions;

  undefined close();
};

dictionary NotificationOptions {
  NotificationDirection dir = "auto";
  DOMString lang = "";
  DOMString body = "";
  USVString navigate;
  DOMString tag = "";
  USVString image;
  USVString icon;
  USVString badge;
  VibratePattern vibrate;
  EpochTimeStamp timestamp;
  boolean renotify = false;
  boolean? silent = null;
  boolean requireInteraction = false;
  any data = null;
  sequence<NotificationAction> actions = [];
};

enum NotificationPermission {
  "default",
  "denied",
  "granted"
};

enum NotificationDirection {
  "auto",
  "ltr",
  "rtl"
};

dictionary NotificationAction {
  required DOMString action;
  required DOMString title;
  USVString navigate;
  USVString icon;
};

callback NotificationPermissionCallback = undefined (NotificationPermission permission);

비지속성 알림은 하나의 Notification 객체로 표현되며 Notification생성자를 통해 생성할 수 있습니다.

지속성 알림은 0개 이상의 Notification 객체로 표현되며 showNotification() 메서드를 통해 생성할 수 있습니다.

3.1. 가비지 컬렉션

Notification 객체는 알림 목록이 해당 알림포함하고, 타입click, show, close, error이벤트 리스너를 가지고 있을 때는 가비지 컬렉션되어서는 안 됩니다.

3.2. 생성자

new Notification(title, options) 생성자 단계는 다음과 같습니다:

  1. this관련 글로벌 객체ServiceWorkerGlobalScope 객체라면, TypeError를 throw합니다.

  2. options["actions"] 가 비어 있지 않으면 TypeError를 throw합니다.

    액션지속성 알림에서만 지원됩니다.

  3. notificationtitle, options, this관련 설정 객체를 인자로 하여 설정 객체로 알림 생성의 결과로 설정합니다.

  4. thisnotification과 연관시킵니다.

  5. 병렬로 다음 단계를 실행합니다:

    1. 알림 권한 상태 가져오기의 결과가 "granted"가 아니면, 태스크 큐잉하여 error 이벤트 발생this에 실행하고 이 단계들을 중단합니다.

    2. notification에 대해 알림 표시 단계를 실행합니다.

3.3. 정적 멤버

정적 permission getter 단계는 알림 권한 상태 가져오기의 결과를 반환합니다.

표준을 편집하는 경우 위 내용을 복사하지 마세요. 동기적 권한은 동기 IO처럼 좋지 않은 아이디어입니다.

개발자는 대신 Permissions query() 메서드를 사용하는 것이 좋습니다. [Permissions]

const permission = await navigator.permissions.query({name: "notifications"});
if (permission.state === "granted") {
   // API를 사용할 권한이 있습니다…
}

정적 requestPermission(deprecatedCallback) 메서드 단계는 다음과 같습니다:

  1. global현재 글로벌 객체로 설정합니다.

  2. promise새로운 Promisethis관련 Realm에서 생성합니다.

  3. 병렬로 다음 단계를 실행합니다:

    1. permissionState사용 권한 요청하기 "notifications"의 결과로 설정합니다.

    2. 글로벌 태스크 큐잉DOM 조작 태스크 소스에서 global에 실행하여 다음 단계를 수행합니다:

      1. deprecatedCallback이 주어졌다면, 콜백 함수 호출 deprecatedCallback에 « permissionState », "report"를 전달하여 실행합니다.

      2. promise 해결promisepermissionState로 실행합니다.

  4. promise를 반환합니다.

알림은 지금까지 최종 사용자에게 미리 요청하는 것이 합리적인 유일한 사례입니다. 다른 API 명세는 이 패턴을 사용하지 말고 더 적합한 대안을 사용해야 합니다.

정적 maxActions getter 단계는 지원되는 최대 액션 수를 반환합니다.

3.4. 객체 멤버

다음은 이벤트 핸들러(및 해당 이벤트 핸들러 이벤트 타입)로 Notification 객체에서 속성으로 지원되어야 하는 것들입니다.

이벤트 핸들러 이벤트 핸들러 이벤트 타입
onclick click
onshow show
onerror error
onclose close

close() 메서드 단계는 닫기 단계this알림에 대해 실행하는 것입니다.

title getter 단계는 this알림제목을 반환하는 것입니다.

dir getter 단계는 this알림방향을 반환하는 것입니다.

lang getter 단계는 this알림언어를 반환하는 것입니다.

body getter 단계는 this알림본문을 반환하는 것입니다.

navigate getter 단계는 다음과 같습니다:

  1. this알림네비게이션 URL 이 null이라면, 빈 문자열을 반환합니다.

  2. this알림네비게이션 URL직렬화하여 반환합니다.

tag getter 단계는 this알림태그를 반환하는 것입니다.

image getter 단계는 다음과 같습니다:

  1. this알림이미지 URL이 없으면 빈 문자열을 반환합니다.

  2. this알림이미지 URL직렬화하여 반환합니다.

icon getter 단계는 다음과 같습니다:

  1. this알림아이콘 URL이 없으면 빈 문자열을 반환합니다.

  2. this알림아이콘 URL직렬화하여 반환합니다.

badge getter 단계는 다음과 같습니다:

  1. this알림배지 URL이 없으면 빈 문자열을 반환합니다.

  2. this알림배지 URL직렬화하여 반환합니다.

vibrate getter 단계는 this알림진동 패턴을 반환하는 것입니다.

timestamp getter 단계는 this알림타임스탬프를 반환하는 것입니다.

renotify getter 단계는 this알림재알림 선호를 반환하는 것입니다.

silent getter 단계는 this알림무음 선호를 반환하는 것입니다.

requireInteraction getter 단계는 this알림상호작용 요구 선호를 반환하는 것입니다.

data getter 단계는 StructuredDeserialize(this알림데이터, this관련 Realm)의 결과를 반환합니다. 예외가 발생하면 null을 반환합니다.

actions getter 단계는 다음과 같습니다:

  1. frozenActionsNotificationAction 타입의 빈 리스트로 설정합니다.

  2. entry에 대해 this알림액션에 대해:

    1. actionNotificationAction의 새 객체로 설정합니다.

    2. action["action"] 을 entry이름으로 설정합니다.

    3. action["title"] 을 entry제목으로 설정합니다.

    4. entry네비게이션 URL이 null이 아니면, action["navigate"] 을 entry네비게이션 URL직렬화하여 설정합니다.

    5. entry아이콘 URL이 null이 아니면, action["icon"] 을 entry아이콘 URL직렬화하여 설정합니다.

    6. actionObject.freeze를 호출하여 스크립트에 의한 실수로 변형되는 것을 방지합니다.

    7. actionfrozenActions에 추가합니다.

  3. frozenActions에서 frozen array 생성의 결과를 반환합니다.

3.5. 예제

3.5.1. 페이지에서 이벤트 사용

비지속성 Notification 객체는 생명주기 동안 이벤트를 디스패치하며, 개발자는 이를 활용해 원하는 동작을 구현할 수 있습니다.

최종 사용자가 알림을 활성화하면 click 이벤트가 디스패치됩니다.

var not = new Notification("Gebrünn Gebrünn by Paul Kalkbrenner", { icon: "newsong.svg", tag: "song" });
not.onclick = function() { displaySong(this); };

3.5.2. 서비스 워커에서 액션 사용

지속성 알림notificationclick 이벤트를 ServiceWorkerGlobalScope에서 발생시킵니다.

여기서 서비스 워커는 "Archive"라는 하나의 알림 액션을 가진 알림을 표시하여, 최종 사용자가 웹사이트를 열지 않고도 이 일반적인 작업을 수행할 수 있도록 합니다(예를 들어, 알림 플랫폼이 알림에 버튼을 표시할 수 있음). 사용자는 알림 본문을 활성화하여 받은 편지함을 열 수도 있습니다.

self.registration.showNotification("New mail from Alice", {
  actions: [{action: 'archive', title: "Archive"}]
});

self.addEventListener('notificationclick', function(event) {
  event.notification.close();
  if (event.action === 'archive') {
    silentlyArchiveEmail();
  } else {
    clients.openWindow("/inbox");
  }
}, false);

3.5.3. tag 멤버를 여러 인스턴스에 사용

웹 애플리케이션은 최종 사용자가 여러 브라우저 탭에서 메일 앱을 여는 등 여러 인스턴스에서 동시에 동작하는 경우가 많습니다. 데스크톱은 공유 리소스이므로, notifications API는 tag 멤버를 사용하여 이러한 인스턴스들이 쉽게 조율할 수 있도록 합니다.

동일 개념의 이벤트를 나타내는 알림은 동일하게 태그 지정할 수 있으며, 둘 다 표시될 때 최종 사용자는 하나의 알림만 받게 됩니다.

Instance 1                                   | Instance 2
                                             |
// Instance notices there is new mail.       |
new Notification("New mail from John Doe",   |
                 { tag: 'message1' });       |
                                             |
                                             |  // Slightly later, this instance notices
                                             |  // there is new mail.
                                             |  new Notification("New mail from John Doe",
                                             |                   { tag: 'message1' });

사용자 에이전트가 이 알고리즘을 따르면, 이 상황의 결과는 하나의 알림 "New mail from John Doe"가 됩니다.

3.5.4. tag 멤버를 단일 인스턴스에 사용

tag 멤버는 앱의 단일 인스턴스에서도 상태 변화에 따라 알림을 최신 상태로 유지하는 데 사용할 수 있습니다.

예를 들어, Alice가 Bob과 채팅 앱을 사용 중이고, Bob이 Alice가 자리를 비운 동안 여러 메시지를 보낼 경우, 앱은 Alice가 각 메시지마다 데스크톱 알림을 보지 않도록 할 수 있습니다.

// Bob says "Hi"
new Notification("Bob: Hi", { tag: 'chat_Bob' });

// Bob says "Are you free this afternoon?"
new Notification("Bob: Hi / Are you free this afternoon?", { tag: 'chat_Bob' });

이 상황의 결과는 하나의 알림이며, 두 번째 알림이 동일 태그를 가진 첫 번째 알림을 대체합니다. 알림을 큐(선입선출)로 처리하는 플랫폼에서는 태그를 사용하면 알림의 큐 내 위치도 유지할 수 있습니다. 최신 알림이 먼저 표시되는 플랫폼에서는 close() 메서드를 사용하여 유사한 결과를 얻을 수 있습니다.

4. 서비스 워커 API

dictionary GetNotificationOptions {
  DOMString tag = "";
};

partial interface ServiceWorkerRegistration {
  Promise<undefined> showNotification(DOMString title, optional NotificationOptions options = {});
  Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {});
};

[Exposed=ServiceWorker]
interface NotificationEvent : ExtendableEvent {
  constructor(DOMString type, NotificationEventInit eventInitDict);

  readonly attribute Notification notification;
  readonly attribute DOMString action;
};

dictionary NotificationEventInit : ExtendableEventInit {
  required Notification notification;
  DOMString action = "";
};

partial interface ServiceWorkerGlobalScope {
  attribute EventHandler onnotificationclick;
  attribute EventHandler onnotificationclose;
};

서비스 워커 등록에는 연관된 showNotification()이 성공적으로 호출된 적이 있는지 여부 (불리언), 처음에는 false입니다.

이것은 Push API 현행 표준의 인프라입니다. [PUSH-API]

showNotification(title, options) 메서드 단계는 다음과 같습니다:

  1. globalthis관련 글로벌 객체로 설정합니다.

  2. promise새로운 Promisethis관련 Realm에서 생성합니다.

  3. thisactive worker가 null이면, promise를 TypeError로 reject하고 promise를 반환합니다.

  4. notificationtitle, options, this관련 설정 객체를 인자로 하여 설정 객체로 알림 생성의 결과로 설정합니다. 만약 이 과정에서 예외가 발생하면 promise를 해당 예외로 reject하고 promise를 반환합니다.

  5. notification서비스 워커 등록this로 설정합니다.

  6. 병렬로 다음 단계를 실행합니다:

    1. 알림 권한 상태 가져오기의 결과가 "granted"가 아니면, 글로벌 태스크 큐잉DOM 조작 태스크 소스에서 global에 실행하여 promise를 TypeError로 reject하고 이 단계들을 중단합니다.

    2. notification에 대해 알림 표시 단계를 실행합니다.

    3. notification서비스 워커 등록showNotification()이 성공적으로 호출된 적이 있는지 여부 를 true로 설정합니다.

    4. 글로벌 태스크 큐잉DOM 조작 태스크 소스에서 global에 실행하여 promise를 undefined로 resolve합니다.

  7. promise를 반환합니다.

getNotifications(filter) 메서드 단계는 다음과 같습니다:

  1. globalthis관련 글로벌 객체로 설정합니다.

  2. realmthis관련 Realm으로 설정합니다.

  3. originthis관련 설정 객체오리진으로 설정합니다.

  4. promise새로운 Promiserealm에서 생성합니다.

  5. 병렬로 다음 단계를 실행합니다:

    1. tagfilter["tag"]로 설정합니다.

    2. notifications리스트로, 알림 목록오리진origin동일 출처이고, 서비스 워커 등록this이며, 태그가 비어 있지 않다면 tag와 같은 알림만 포함하는 리스트로 설정합니다.

    3. 글로벌 태스크 큐잉DOM 조작 태스크 소스에서 global에 실행하여 다음 단계를 수행합니다:

      1. objects리스트로 설정합니다.

      2. 알림에 대해 notifications에서 생성 순서대로, realm을 사용해 해당 알림을 나타내는 Notification 객체를 새로 만들고 objects에 추가합니다.

      3. promise를 objects로 resolve합니다.

  6. promise를 반환합니다.

이 메서드는 0개 이상의 Notification 객체를 반환하며, 이 객체들은 이미 존재하는 Notification 객체와 동일한 알림을 나타낼 수 있습니다.


서비스 워커 알림 이벤트 발행을 하기 위해 name라는 이름으로, 알림 notification 및 선택적 문자열 action(기본값은 빈 문자열)을 입력으로 받아, Fire Functional Eventname, NotificationEvent, notification서비스 워커 등록, 그리고 다음 초기값을 넘겨 실행합니다.

notification
notification을 나타내는 새 Notification 객체
action
action

notification getter 단계는 초기화된 값을 반환하는 것입니다.

action getter 단계는 초기화된 값을 반환하는 것입니다.

아래의 이벤트 핸들러(및 해당 이벤트 핸들러 이벤트 타입)는 ServiceWorkerGlobalScope 객체에서 속성으로 지원되어야 합니다:

이벤트 핸들러 이벤트 핸들러 이벤트 타입
onnotificationclick notificationclick
onnotificationclose notificationclose

감사의 글

감사합니다: Addison Phillips, Aharon (Vladimir) Lanin, Alex Russell, Anssi Kostiainen, Arkadiusz Michalski, Boris Zbarsky, Brady Eidson, David Håsäther, Doug Turner, Drew Wilson, Ehsan Akhgari, Frederick Hirsch, Ian Hickson, Jake Archibald, James Graham, John Mellor, Jon Lee, Jonas Sicking, Kagami Sascha Rosylight, Michael Cooper, Michael Henretty, Michael™ Smith, Michael van Ouwerkerk, Mike Taylor, Nicolás Satragno, Olli Pettay, Peter Beverloo, Philip Jägenstedt, Reuben Morais, Rich Tibbett, Robert Bindar, 박상현 (Sanghyun Park), Simon Pieters, Theresa O’Connor, timeless, 그리고 triple-underscore 여러분의 멋진 기여에 감사합니다.

이 현행 표준은 Anne van Kesteren (Apple, annevk@annevk.nl)이 작성했습니다. 이전 버전은 John Gregg (Google, johnnyg@google.com)이 작성했습니다.

지적 재산권

Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). 이 저작물은 크리에이티브 커먼즈 저작자표시 4.0 국제 라이선스에 따라 라이선스가 부여됩니다. 일부가 소스 코드에 포함되는 경우, 해당 부분은 BSD 3-Clause License에 따라 소스 코드로 라이선스됩니다.

이것이 현행 표준입니다. 특허-검토 버전이 필요한 분은 현행 표준 검토 초안을 참고하세요.

색인

이 명세서에서 정의된 용어

참조로 정의된 용어

참고 문헌

규범적 참고 문헌

[BCP47]
A. Phillips, Ed.; M. Davis, Ed.. Tags for Identifying Languages. 2009년 9월. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc5646
[BIDI]
Manish Goregaokar मनीष गोरेगांवकर; Robin Leroy. Unicode Bidirectional Algorithm. 2024년 9월 2일. Unicode Standard Annex #9. URL: https://www.unicode.org/reports/tr9/tr9-50.html
[DOM]
Anne van Kesteren. DOM 표준. 현행 표준. URL: https://dom.spec.whatwg.org/
[FETCH]
Anne van Kesteren. Fetch 표준. 현행 표준. URL: https://fetch.spec.whatwg.org/
[HR-TIME]
Yoav Weiss. 고해상도 시간. URL: https://w3c.github.io/hr-time/
[HTML]
Anne van Kesteren; 외. HTML 표준. 현행 표준. URL: https://html.spec.whatwg.org/multipage/
[INFRA]
Anne van Kesteren; Domenic Denicola. Infra 표준. 현행 표준. URL: https://infra.spec.whatwg.org/
[Permissions]
Marcos Caceres; Mike Taylor. 권한. URL: https://w3c.github.io/permissions/
[SERVICE-WORKERS]
Yoshisato Yanagisawa; Monica CHINTALA. Service Workers. URL: https://w3c.github.io/ServiceWorker/
[URL]
Anne van Kesteren. URL 표준. 현행 표준. URL: https://url.spec.whatwg.org/
[VIBRATION]
Anssi Kostiainen. 진동 API. URL: https://w3c.github.io/vibration/
[WEBIDL]
Edgar Chen; Timothy Gu. Web IDL 표준. 현행 표준. URL: https://webidl.spec.whatwg.org/

비규범적 참고 문헌

[PUSH-API]
Peter Beverloo; Martin Thomson; Marcos Caceres. Push API. URL: https://w3c.github.io/push-api/

IDL 색인

[Exposed=(Window,Worker)]
interface Notification : EventTarget {
  constructor(DOMString title, optional NotificationOptions options = {});

  static readonly attribute NotificationPermission permission;
  [Exposed=Window] static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback deprecatedCallback);

  static readonly attribute unsigned long maxActions;

  attribute EventHandler onclick;
  attribute EventHandler onshow;
  attribute EventHandler onerror;
  attribute EventHandler onclose;

  readonly attribute DOMString title;
  readonly attribute NotificationDirection dir;
  readonly attribute DOMString lang;
  readonly attribute DOMString body;
  readonly attribute USVString navigate;
  readonly attribute DOMString tag;
  readonly attribute USVString image;
  readonly attribute USVString icon;
  readonly attribute USVString badge;
  [SameObject] readonly attribute FrozenArray<unsigned long> vibrate;
  readonly attribute EpochTimeStamp timestamp;
  readonly attribute boolean renotify;
  readonly attribute boolean? silent;
  readonly attribute boolean requireInteraction;
  [SameObject] readonly attribute any data;
  [SameObject] readonly attribute FrozenArray<NotificationAction> actions;

  undefined close();
};

dictionary NotificationOptions {
  NotificationDirection dir = "auto";
  DOMString lang = "";
  DOMString body = "";
  USVString navigate;
  DOMString tag = "";
  USVString image;
  USVString icon;
  USVString badge;
  VibratePattern vibrate;
  EpochTimeStamp timestamp;
  boolean renotify = false;
  boolean? silent = null;
  boolean requireInteraction = false;
  any data = null;
  sequence<NotificationAction> actions = [];
};

enum NotificationPermission {
  "default",
  "denied",
  "granted"
};

enum NotificationDirection {
  "auto",
  "ltr",
  "rtl"
};

dictionary NotificationAction {
  required DOMString action;
  required DOMString title;
  USVString navigate;
  USVString icon;
};

callback NotificationPermissionCallback = undefined (NotificationPermission permission);

dictionary GetNotificationOptions {
  DOMString tag = "";
};

partial interface ServiceWorkerRegistration {
  Promise<undefined> showNotification(DOMString title, optional NotificationOptions options = {});
  Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {});
};

[Exposed=ServiceWorker]
interface NotificationEvent : ExtendableEvent {
  constructor(DOMString type, NotificationEventInit eventInitDict);

  readonly attribute Notification notification;
  readonly attribute DOMString action;
};

dictionary NotificationEventInit : ExtendableEventInit {
  required Notification notification;
  DOMString action = "";
};

partial interface ServiceWorkerGlobalScope {
  attribute EventHandler onnotificationclick;
  attribute EventHandler onnotificationclose;
};

MDN

Notification/Notification

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for AndroidNoneAndroid WebView?Samsung Internet?Opera Mobile?
MDN

Notification/actions

In only one current engine.

FirefoxNoneSafariNoneChrome53+
Opera39+Edge79+
Edge (Legacy)18IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?

NotificationEvent/action

Firefox44+SafariNoneChrome48+
OperaNoneEdge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera MobileNone
MDN

Notification/badge

In only one current engine.

FirefoxNoneSafariNoneChrome53+
Opera39+Edge79+
Edge (Legacy)18IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/body

In all current engines.

Firefox26+Safari11+Chrome33+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/click_event

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS SafariNoneChrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/close

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/close_event

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS SafariNoneChrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/data

In all current engines.

Firefox34+Safari16+Chrome44+
Opera?Edge79+
Edge (Legacy)16+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/dir

In all current engines.

Firefox26+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/error_event

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS SafariNoneChrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/icon

In all current engines.

Firefox26+Safari11+Chrome33+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/image

In only one current engine.

FirefoxNoneSafariNoneChrome56+
Opera?Edge79+
Edge (Legacy)18IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/lang

In all current engines.

Firefox26+Safari11+Chrome33+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/maxActions_static

In only one current engine.

FirefoxNoneSafariNoneChrome48+
Opera?Edge79+
Edge (Legacy)18IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/permission_static

In all current engines.

Firefox22+Safari7+Chrome32+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/renotify

In only one current engine.

FirefoxNoneSafariNoneChrome50+
Opera?Edge79+
Edge (Legacy)?IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/requestPermission_static

In all current engines.

Firefox22+Safari15+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android22+iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/requireInteraction

In only one current engine.

FirefoxNoneSafariNoneChrome47+
Opera?Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/show_event

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS SafariNoneChrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/silent

FirefoxNoneSafari17+Chrome43+
Opera?Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/tag

In all current engines.

Firefox26+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS SafariNoneChrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/timestamp

In only one current engine.

FirefoxNoneSafariNoneChrome50+
Opera?Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/title

In all current engines.

Firefox26+Safari11+Chrome33+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android42+Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

Notification/vibrate

In only one current engine.

FirefoxNoneSafariNoneChrome53+
Opera?Edge79+
Edge (Legacy)?IENone
Firefox for Android?iOS Safari?Chrome for Android53+Android WebViewNoneSamsung Internet6.0+Opera Mobile41+
MDN

Notification

In all current engines.

Firefox22+Safari7+Chrome20+
Opera23+Edge79+
Edge (Legacy)14+IENone
Firefox for Android?iOS Safari16.4+Chrome for AndroidNoneAndroid WebViewNoneSamsung InternetNoneOpera MobileNone
MDN

NotificationEvent/NotificationEvent

In all current engines.

Firefox44+SafariNoneChrome42+
Opera37+Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile37+
MDN

NotificationEvent/notification

Firefox44+SafariNoneChrome42+
Opera37+Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari?Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile37+
MDN

NotificationEvent

In all current engines.

Firefox44+SafariNoneChrome42+
Opera37+Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile37+
MDN

ServiceWorkerGlobalScope/notificationclick_event

Firefox44+SafariNoneChrome40+
Opera24+Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS SafariNoneChrome for Android?Android WebView?Samsung Internet?Opera Mobile?
MDN

ServiceWorkerGlobalScope/notificationclick_event

Firefox44+SafariNoneChrome40+
Opera24+Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS SafariNoneChrome for Android?Android WebView?Samsung Internet?Opera Mobile?
MDN

ServiceWorkerGlobalScope/notificationclose_event

Firefox44+SafariNoneChrome50+
Opera34+Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS SafariNoneChrome for Android?Android WebView?Samsung Internet?Opera Mobile34+
MDN

ServiceWorkerRegistration/getNotifications

In all current engines.

Firefox44+SafariNoneChrome40+
Opera?Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?
MDN

ServiceWorkerRegistration/showNotification

In all current engines.

Firefox44+SafariNoneChrome42+
Opera?Edge79+
Edge (Legacy)17+IENone
Firefox for Android?iOS Safari16.4+Chrome for Android?Android WebViewNoneSamsung Internet?Opera Mobile?