When you hear “web push” you probably think about notifications… but that is not necessary true. In theory, the web push technology could be used for delivering messages or updates to the web app, without displaying a notification to a user.
On some browsers, the permission prompt for notifications can be displayed only after a user interaction with the website. Let’s see why some browsers enforce this rule, what happens if you don’t comply with it and how can you implement a solution that works across all major browsers.
Chrome 84 will fight abusive notifications. Let’s see what you should do to stay complaint and avoid the penalization.
Browsing the web, you may have noticed that most websites use a double opt-in process for subscribing the users to notifications. Basically these websites first show a custom prompt (designed with HTML / CSS) that asks you if you are interested in the notifications, then, when you click the subscribe button, they display another prompt (with native appearance) asking you if you really want to allow the notifications from the website. Isn’t one prompt enough?
Usually the prompt for web push notifications is displayed only once, the first time that the user visits a website. What if the user blocks the notifications? Is there a way to show the notifications prompt when the user visits the website again?
Forcing the user to subscribe to push notifications is probably not a good choice for most websites. However there are some specific situations where it makes sense to do that.
You can change your notification preferences for a website at any time. You can allow or block the notifications using the browser preferences:
Many issues related to web push notifications can be solved by simply resetting the browser permission. That removes the old browser subscription and creates a new subscription.
The working draft of the Push API currently doesn’t offer a good way to manage unsubscriptions.
The problems arise in the following scenarios:
- The user blocks the notifications from the browser preferences
- The endpoint is replaced because it has expired