FAQ: Browser Behavior

Understanding how browsers handle web push notifications

What happens when subscriptions clear their browser cache and cookies?

Browsers have implemented the Web Push Standard in a way that when subscribers clear their browser cookies and cache, they get unsubscribed from notifications. This is because subscription data is stored in the browser's IndexedDB storage. Removing that data makes the browser "forget" that subscription.

However, clearing this data does not remove the permissions that have already been granted by the subscription to receive notifications in that browser.

If you are using an HTTPS site and did not select "My site is not fully https" in your OneSignal dashboard settings, then you can automatically re-subscribe users that return to your site after they clear their browser cache and cookies by making sure Auto Resubscribe is turned on in the configuration. If you are using a Custom Code setup, also make sure that autoRegister is not in the init call.

However, users will not be auto-resubscribed if they change their Browser's Notification Permissions to "Ask" or "Block":

Users will also not be auto-resubscribed if they clear notifications from the Browser's Notification Settings:

  • Chrome: chrome://settings/content/notifications
  • Firefox: about:preferences#privacy > Permissions > Notifications
  • Safari: Preferences > Websites > Notifications > Remove

When users get resubscribed, they will get a new OneSignal Player ID record. You can find your Player ID in the Console using await OneSignal.getUserId();

See other ways subscriptions can Unsubscribe from Notifications.

How do I test that "auto-resubscribe" is working?

On your site, subscribe to receive notifications.

You can open up your browser's developer console and type:

await OneSignal.getUserId(); - This will log your OneSignal Player ID.

You can also send yourself a notification from the console using:

OneSignal.sendSelfNotification(); - This will send a notification to yourself.

If you are successfully subscribed and did not get the notification, see Notifications Not Shown.

If you are not successfully subscribed, see Troubleshooting Web Push.

In the browser settings, you can clear your browser history, or:

  1. Select the Lock button on your site next to the URL
  2. Select Cookies
  3. Select your site
  4. Click "Remove"
  5. Click "Done"

Refresh the page. You will not be prompted to resubscribe.

Open the browser console and input:

await OneSignal.getUserUserId(); - This will be create a new OneSignal Player ID for you.

OneSignal.sendSelfNotification(); - This will send a notification to yourself.

You have successfully resubscribed to your site after clearing your browser cache.

Can users receive notifications even when the browser is closed?

Browsers behave differently across platforms. Please refer to the table below for support for receiving notifications even when the browser is closed.

Browser NameAndroidWindowsmacOS
Chrome / ChromiumYesYesNo

Chrome - Chrome runs as a background process by default even when all the windows are closed. As long as the background process is running, notifications will still be received. If the Chrome background process is not running, notifications will not be received.

Firefox - On Mac OS X, the process still exists even if windows are closed, and a notification can be received if all windows are closed (as long as there is still a dot in the dock showing Firefox is still running). On Windows, the process exits after all windows are closed so notifications cannot be received unless a Firefox window is still open.

Safari - Safari does not have to be running to receive notifications, as they are sent directly to the operating system. The user still has to sign up for Safari web notifications, but after that they will be received even when Safari is completely closed.

Subscribers have up to 3 days to retrieve the last known missing notification before messages expire permanently.

For example, suppose a subscriber was supposed to receive a Firefox web push notification, but Firefox was closed. If the subscriber opens Firefox within 3 days, the subscriber will receive only the last known web push notification that didn't expire. If the subscriber opens Firefox after 3 days, the web push notification sent more than 3 days ago will not be received.