Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Check Web Push supportability (JS SDK)
Method Objective
The method allows checking if Web Push is available in the browser.
Warning |
---|
Web Push Notifications don't work in incognito mode. The method will give a false result when the browser is in that mode. |
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("sunscriptionsubscription", "web_push_supported", callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback | function | required | It's a callback function that takes a boolean value of the check result as a parameter. |
API response
Value | Type |
---|---|
The result of checking Web Push support | boolean |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_supported", function(supported) { if (supported) { // if Web Push is supported } else { // if Web Push isn't supported } }); |
Checking a user's subscription status
Method Objective
The method checks if the user has permitted to show Web Push notifications.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("sunscriptionsubscription", "web_push_subscribed", callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback | function | required | It's a callback function that takes a boolean value of the check result as a parameter. |
API response
Value | Type |
---|---|
The result of the permission check | boolean |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_subscribed", function(subscibed) { if (subscibed) { // if the user has permitted Web Push notifications } else { // if the user hasn't yet permitted Web Push notifications or has rejected the request } }); |
Table of Contents | ||||
---|---|---|---|---|
|