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.
In this article
Instance properties
PushSubscriptionOptions.userVisibleOnly
Read onlyA boolean value indicating that the returned pushsubscription will only be used for messages whose effect is made visible to the user.
PushSubscriptionOptions.applicationServerKey
Read onlyA 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.
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
Loading…