Shortcode to create "Enable Push Notification" Button
The recent updates to browsers suggest that users should be prompted to give permission for notification when interacting with the website rather than when the page loads. Therefore, we’ve provided the admin with the option of deciding when to request permission from users to receive notifications.
- If you want the website to request permission from the user as soon as the website loads, then all you need to do is enable notification onload from Customizer > Other Customizations > Ask Notification Permission Onload? => On
- If you want your users to receive permission on user interactions, then you can set “Notification Permission Onload” to OFF, and use the below shortcode on your website instead
[cmd_enable_notification]This shortcode simply adds a button to your website that helps your user to enable disable notifications.In order for notifications to work, the user’s browser must grant permission for the website to send notifications. The user is prompted to log in on clicking this button if they are visiting your website for the first time. Upon successful login, the browser asks for notification permission. Once the user gets the permission pop-up, he/she will have to click on “Allow” to receive push notifications from your website.
Last Updated 3 years ago