A user visits a website and subscribes to the notifications. Then, after some time, he opens the browser settings and clicks “clear data” in order to remove the history and all the data stored by the browser on the device. What happens to the notifications in this case?
The above scenario is quite common and worth analyzing. In particular we have tested the steps on Chrome, which has the largest market share.
When you click “clear data” in the browser settings, all data, including the push subscription is removed from storage. This is what happens:
- The push subscription is removed from the browser push service (to be more precise, it becomes expired and it will return 410 Gone when you try to send a notification to it)
- The push subscription is removed from the local device (when you call
PushManager.getSubscription()you will get
- The permission is still granted (unless you also reset the permissions). This means that the next call to
PushManager.subscribe()will subscribe the user and generate a new push subscription without displaying the permission prompt.
Accordingly, if you use Pushpad for sending the notifications and a subscriber clicks “clear data“, you can expect the following:
- The push subscription is detected as expired by Pushpad and is removed automatically as soon as you try to send a notification to it
false, since the user is no longer subscribed (in this way your code knows that you should try to subscribe the user again)
- The permission is still granted, so when you try to subscribe the user again, using
pushpad('subscribe')for example, he will not see the browser permission prompt.
granted” permission and no subscription (
null) at the same time.