Web Push FAQ

Common questions about OneSignal's Web Push Notifications

What Platforms Support Web Push Notifications?

All major browsers support Web Push. Android devices may also receive Web Push notifications in addition to notifications from apps as long as they can connect to the push gateway servers. Below is a list of platforms and browsers that offer support for web push notifications.

Browser Support by Operating System

Incognito Mode, Private Browsing Mode, and Guest Browser Mode do not support Web Push.

BrowserWindows PCmacOSAndroidiOS (iPhone, iPad)
Microsoft Edge1YesYesYesNo
Samsung Internet Browser1NoNoYesNo
UC Browser1YesNoYesNo
Internet Explorer 2NoNoNoNo

Note 1: Microsoft Edge (2019 Update), Opera, Samsung Browser, Yandex, and UC Browser are all Chromium-based browsers and will be marked as Chrome in OneSignal.
Note 2: Internet Explorer is no longer receiving feature updates. Microsoft has switched browser development to the Edge platform.

Support by Browser Version

BrowserMin Version
Google ChromeChrome 50+.

Chrome v42 is when web push notifications started being supported, but it uses an older payload that is no longer supported by OneSignal. More information on this here.
Mozilla FirefoxFirefox v47+

Firefox ESR versions do not support web push notifications.

Firefox v44+ is when web push notifications started being supported, but it uses an older payload that is no longer supported by OneSignal. More information on this here. If you are testing support in this browser, visit this webpage and let us know if you see any Supported: false or Errors.
Apple SafariSafari 10+ on macOS

Apple does not support Web Push notifications on iOS at this time.

How do I change my domain?

Browsers have setup web push in a way that ties subscribers to a specific origin (domain/site URL).

For security purposes and browser's same origin policy, browsers do not allow subscribers to be moved to other origins. This is not a OneSignal limitation, any provider that claims you can move subscribers from one site origin to another you should verify it is your site origin they are subscribing users under.

Sites with different origins include:

  • Changing from HTTP to HTTPS
  • www.mysite.com and non-www version
  • domain1.com and domain2.com

If you changed your site origin, the best solution is to set up a new OneSignal app and have your users subscribe to the new site origin under this new OneSignal app.

You will not able to import subscribers from one origin to another origin.

You can continue sending push notifications to your subscribers on the old origin (old OneSignal app), but your users will need to re-subscribe to the new origin to get push from the new domain.

The recommended steps for migration are as follows:

  1. Setup a new OneSignal App ID for the new site domain.
  2. Continue to send push from the old OneSignal App with old site domain. In the "Launch URL" of the notifications, use the new site domain.
  3. After 2 weeks to 2 months (depending on how many notifications you send per day and how many subscribers you get on the new origin) you can then stop sending from the old OneSignal app and only use the new OneSignal app.
  • For example if you send 1+ notifications per day, then 2 weeks should be enough time to have your users subscribe to the new domain.
  • If you send 2+ notifications per week, then 2 months should be enough time.
  • If you send the same message from the old OneSignal App and new OneSignal app, any subscribers under both will get duplicate messages. This is why the timeframes are recommended.
  1. You can send a couple "We've moved, click here to visit our new site to subscribe again and stay updated" messages. This will help alert people that they may not get push from your site if they don't return to subscribe. Best to send this at the beginning of the move and last message sent from the app.

Unfortunately all websites and user-bases are different. Be prepared to lose subscribers in the short term.

Can I setup multiple websites or subdomains with a single OneSignal App?

Browsers have implemented web push in a way that works best with only one main origin (domain/site url). Separate origins of a site cannot be merged to one app.

For example, browsers will not allow https://mysite.com and https://www.mysite.com to both collect the same subscribers.

Due to this browser limitation, it is not possible to unify multiple origins into a single OneSignal App. This can cause issues with duplicate notifications, and a poor user experience.

Generally, your options are:

  1. Only subscribe users on one origin. If you have subdomains or landing pages or any other sites using multiple origins, you can redirect users to the "main" origin to subscribe, then redirect them back to the other origin to continue browsing.

  2. Create separate OneSignal Apps for separate origins. Notifications will arrive independently of each other. This means users who subscribe to multiple sites will receive duplicate notifications if you send the same notifications on all sites.

More details in our guide for setting up Complex Web Push Integrations.

What should I do if I upgraded my site to HTTPS?

Browsers require 2 things for web push notifications to work:

  1. An HTTPS site
  2. Service worker files added to the server

If you had an HTTP site, and upgraded to HTTPS (or, you are now able to add service workers to your site), browser's will treat the HTTPS site as a new origin.

Please see How do I change my Domain for details.

Can I transfer subscribers from one site to another?

If you changed your site's origin, your users will need to subscribe to that new site origin. See How do I change my Domain for more details.

What if my site supports multiple languages?

If your site supports multiple languages through a subdirectory like: https://mysite/com/en_us/ or https://mysite.com/other-language/ then you have the same origin (https://mysite.com) and you can setup multiple languages on prompts following our Prompting FAQ to translate prompts and send push in different languages following Language & Localization.

If your site supports multiple languages through a subdomain like: https://en.mysite.com, then this would be separate origins and would require multiple OneSignal Apps. Each origin will need it's own OneSignal App Id.

Can I have multiple OneSignal Apps for the same site?

You can have multiple OneSignal App IDs on a single origin, but it is not recommended.

Each OneSignal App creates unique VAPID keys for the Site Origin attached to that App ID. VAPID keys facilitate the subscription process to the subscriber's browser and your site origin.

If you add multiple App IDs to the same site origin, OneSignal will auto-resubscribe the user to the last visited App ID. So you will see subscribers bounce back and forth between App IDs if they are able to visit pages with different App IDs.

For example, if you subscribed to https://yoursite.com/home using "App_ID_1", then visit https://yoursite.com/shop using "App_ID_2", OneSignal will unsubscribe you from "App_ID_1" and then auto-subscribe them to "App_ID_2".

You will see many unsubscribed devices on each app, as users bounce between them.

The recommended approach is to Add Data Tags to devices in order to differentiate them based on URLs.

What if my site is in a subfolder?

Web push is configured at the origin level.

If your site is hosted in a subfolder, like https://example.com/blog (where blog is the subfolder), your web push domain will be https://example.com. Continue the setup process with your main site origin. If you must add the service workers to the subfolder see Customizing Your Service Worker Integration.

Can OneSignal SDK files be served from a subfolder of my site?

Yes, please see OneSignal Service Worker guide for more details.

Why does my site require a label?

The Web Push Standard adopted by all major web browsers requires notifications to come from an HTTPS address with technologies that support web push (specifically, the ability to upload files to the root directory).

OneSignal has developed a workaround since not all sites fully support these technologies - even if the websites themselves support HTTPS.

Our workaround (called the OneSignal HTTP SDK) creates a site that we host for the sole purpose of delivering your notifications. This site (os.tc) creates a unique subdomain based on your label (like yoursite.os.tc) that is displayed to users when they receive your notifications.

For example:

The label you select must be unique - if somebody else is already using it, you must choose another.

Why do you require a label for my website builder?

Several website builders must the OneSignal HTTP SDK that requires a label, because these technologies do not allow files to be uploaded to the root directory. These site builders include:

  • Blogger
  • Shopify
  • Squarespace
  • Weebly
  • Some Wordpress implementations
  • Some Drupal implementations
  • Some Joomla implementations
  • Some Magento implementations

Why can't I change my site's label?

OneSignal allows you to experiment with different labels when you have fewer than 100 web subscribers to give you some extra flexibility while you're still deciding how to use push notifications.

After your app has 100+ web subscribers, this setting is disabled, and you must start over with a new OneSignal app to use a different label.

We do this because changing your label can cause subscribers to receive duplicate notifications.

Can I host the OneSignal SDK files myself?

We highly recommend against this. Browsers are constantly changing and updating how users and websites can use web push notifications.

OneSignal makes sure these changes are implemented as soon as possible to make sure your site is working correctly. You should use the OneSignal CDN URL supplied in the Web Push Settings instead of hosting the files yourself, unless our documentation specifically tells you to do so.

Can I customize the OneSignal init code?

You can customize the OneSignal init code only if you've selected Custom Code Setup when setting up your OneSignal app.

If you select Typical Setup or Website Builder when setting up your OneSignal app, any init code you add to your site's pages will be ignored by the OneSignal SDK.

How do I test my site on a local environment?

See Web Push Advanced Options.

Can OneSignal integrate with another Service Worker on my site or a Progressive Web App?

Yes! Please see Integrating Multiple Service Workers.

Why use .push in the SDK?

You may have noticed the need to wrap your OneSignal calls with OneSignal.push(function() { ... })

OneSignal.push(function() {
  /* ... */

The OneSignal SDK is loaded asynchronously on your page. For example:

<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async"></script>

You can read more about the async attribute here and here.

Basically, a script without an async attribute stops the loading of the rest of the page while it is fetched and executed, but async scripts allow the rest of the page to load, while it is eventually fetched and executed.

This presents a problem for page scripts that depend on the OneSignal variable existing.

Most of the OneSignal code examples begin with:

window.OneSignal = window.OneSignal || [];

This creates a OneSignal variable, and if OneSignal is already loaded, it's then assigned to the loaded instance. Otherwise, the OneSignal variable equals an empty array - [].

All arrays have a .push() function, so at this point, the OneSignal variable is simply an array of functions we're pushing on to it.

When the SDK finally loads, the SDK processes all the functions pushed so far and redefines .push().

Original Stack Overflow discussion: http://stackoverflow.com/a/38466780/555547

What’s Next