Baseline 2023
Newly available
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The toJSON()
method of the PushSubscription
interface is a standard serializer: it returns a JSON representation of the subscription properties, providing a useful shortcut.
None.
Return valueA JSON object. It contains the subscription endpoint, expirationTime
and public keys, as an endpoint
member, an expirationTime
member and a keys
member.
navigator.serviceWorker.ready.then((reg) => {
reg.pushManager.getSubscription().then((subscription) => {
const mySubscription = subscription.toJSON();
// do something with subscription details
});
});
Specifications Browser compatibility
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4