Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. PushSubscriptionOptions

PushSubscriptionOptions

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2023⁩.

* Some parts of this feature may have varying levels of support.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

ThePushSubscriptionOptions interface of thePush API represents the options associated with a push subscription.

The read-onlyPushSubscriptionOptions object is returned by callingPushSubscription.options on aPushSubscription. This interface has no constructor of its own.

Instance properties

PushSubscriptionOptions.userVisibleOnlyRead only

A boolean value indicating that the returned pushsubscription will only be used for messages whose effect is made visible to the user.

PushSubscriptionOptions.applicationServerKeyRead only

A public key your push server will use to sendmessages to client apps via a push server.

Examples

CallingPushSubscription.options on aPushSubscription returns aPushSubscriptionOptions object. In the example below this is printed to the console.

js
navigator.serviceWorker.ready.then((reg) => {  reg.pushManager.getSubscription().then((subscription) => {    const options = subscription.options;    console.log(options); // a PushSubscriptionOptions object  });});

Specifications

Specification
Push API
# dom-pushsubscriptionoptions

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp