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.
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
- WordPress Setup - Native Prompt
- Custom Code Setup - Native Prompt
- Why is Slide Prompt Showing On Mobile?
Select the Native Prompt within Settings > All Browsers Configuration > Step 3 Permission Prompt Setup > Slide Prompt.
Customizable options for Native Browser Prompt.
|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.|
|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.|
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.
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.
When finished, press Save and Save again on the next page to see this go into effect.
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.
Using the Custom Code Setup, this can be triggered any time via the
RECOMMENDED: See examples for Adding a Prompt Delay.
See above section based on your setup for more details.
Great questions! More details here.
A browser's Native Permission Prompt may not show when triggered if one of these conditions is true:
- The browser prevented the prompt from showing.
- The user has already allowed notifications or already subscribed
- The user blocked notifications. If a user clicks "Block" (Chrome), "Don't Allow" (Safari), or "Never Allow" (Firefox) they can never be prompted again and must subscribe through a multi-step process in the browser settings. This is why it is recommended to use the OneSignal Slide Prompt.
- Auto-Prompt is turned off and no call to
- On mobile, OneSignal defaults to the slide prompt, see Why is Slide Prompt Showing On Mobile for details on changing this.
OneSignal defaults to the Slide Prompt on mobile devices for 2 reasons:
- 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/
- 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:
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.
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 almost 3 years ago