OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Native Browser Prompt

The Required Native Browser Prompt Details: Triggering and FAQ

The Native Browser Permission Prompt is required for web push subscription and is not customizable. It uses the language set in the user's browser settings. Only HTTPS websites can show the native browser prompt.

Desktop (Chrome) HTTPS site

🚧

Browsers Are Changing How Notification Permission Prompts Work.

Chrome, Firefox and Safari have changed how prompting works. If you trigger the Native Permission Prompt, you may see the following changes:
Chrome 80+ adds a quieter UI for prompting users who typically deny permissions and automatically for sites that get denied for push more frequently.
Safari 12.1+ and Firefox 72+ add the requirement for a "user gesture" (clicking a button) before the native prompt is shown.

Read more about these changes and best practices in our blog post: Browsers Are Changing How Notification Permission Prompts Work.

OneSignal already provides what you need to stay ahead of these changes with our OneSignal Prompts and the ability to show these prompts at relevant moments.

Quick Jump To Your Setup:


Typical Setup Native Prompt

Select the Native Prompt within Settings > All Browsers Configuration > Step 3 Permission Prompt Setup > Slide Prompt.

Customizable options for Native Browser Prompt.

Option

Details

Auto-prompt

Show the prompt without additional code. Adds a delay on showing the prompt based on both time and/or number of page views.

Page Views

Amount of times the user visits a URL of your site with the OneSignal code.
0 or 1 page view is the first time they visit the site.

Seconds

Amount of time that needs to pass while the user is on the page of your site with the OneSignal code for the prompt to show.
0 seconds means show as soon as possible (after the site loads).
300 seconds means show after 5 minutes.

You can combine Page Views and Seconds together. For example, if your common user visits your home page, another page and a 3rd page, you can set: 3 page views and 30 seconds. The prompt will show on the 3rd page and after 30 seconds has passed.

To trigger the Native Browser Prompt programmatically, toggle off Auto-prompt switch. Then use the OneSignal.showNativePrompt(); method (recommended) when ready to prompt.

📘

Best Practice!

Use the Slide Prompt with a delay to gauge user interest first.
If the user declines the Slide prompt, you can always trigger the Native Browser Prompt at another time with OneSignal.showNativePrompt(); method after the user has more time to decide if they want to subscribe.

👍

Save Settings!

When finished, press Save and Save again on the next page to see this go into effect.


Wordpress Native Prompt

You must have an HTTPS site and selected "My site uses an HTTPS connection (SSL)" at the top of the WordPress Plugin.

To enable the Native Prompt upon visiting the site, go to "Prompt Settings & Subscription Bell" and enable:

Attempt to automatically prompt new site visitors with Native Browser Prompt (not recommended)

This is found under the "Subscription Bell" options and above the "Prompt Customizations" options. Then press "Save" at the bottom of the plugin.

If you would like to add a delay to this prompt, it will require adding some additional setup. Please see the WordPress Prompt Delay Code for more.


Custom Code Native Prompt

Using the Custom Code Setup, this can be triggered any time via the OneSignal.showNativePrompt(); method.

RECOMMENDED: See examples for Adding a Prompt Delay.


Native Prompt FAQ

How do I add a delay to the prompt?

See above section based on your setup for more details.

How many times does the prompt show?

Great questions! More details here.

Why is the Native Prompt not showing up?

A browser's Native Permission Prompt may not show when triggered if one of these conditions is true:

Why is Slide Prompt Showing On Mobile?

OneSignal defaults to the Slide Prompt on mobile devices for 2 reasons:

  1. Google made a change to the Native Prompt on Chrome for Android that is a very user unfriendly pop-up and help prevent your users from having a bad experience on your site. We published a blog post that explains these changes here: https://onesignal.com/blog/web-push-changes-to-chrome-on-android/
  2. Also due to further updates by the browsers, the native prompt alone may not work anymore if you call it right away, you can read more about these changes here: https://onesignal.com/blog/changes-to-chrome-and-firefox-permission-prompting/

We highly recommend using the Slide Prompt and you can customize it following our Slide Prompt Guide.

If you really want to only show just the native prompt on your site, you can simply follow these directions:

Typical or Custom Sites

For Typical Setup, make sure Auto-Prompt is turned off (see above).

Then for Typical Setup and Custom Code setup, you must call OneSignal.registerForPushNotifications() method after the init call. We advise not to call this immediately upon user visiting the page.

WordPress Users

You will need to follow this guide on adding a delay to your prompt.

You can set the value for var notificationPromptDelay to whatever you like, 0 means no delay.

Updated 4 months ago



Native Browser Prompt


The Required Native Browser Prompt Details: Triggering and FAQ

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.