How to trigger the native notification permission prompt on Firefox and Safari?
Adapting your web push implementation to display Firefox and Safari's native permission prompt using user gestures.
Last updated
Adapting your web push implementation to display Firefox and Safari's native permission prompt using user gestures.
Last updated
function displayNativePermissionRequest(){
if (navigator.userAgent.indexOf("Firefox") !== -1 || (navigator.userAgent.indexOf("Safari") !== -1 && navigator.userAgent.indexOf("Chrome") === -1)) {
batchSDK(function(api){api.ui.show('native', true)});
}
}var batchSDKUIConfig = { native: {}
}
if(navigator.userAgent.indexOf("Firefox") !== -1 || navigator.userAgent.indexOf("Safari") !== -1 && navigator.userAgent.indexOf("Chrome") === -1) {
batchSDKUIConfig = {
alert: { icon: 'https://mydomain.com/icon.png',
backgroundColor: '#FFFFFF',
text: 'Subscribe to our notifications!',
}
}
}
batchSDK('setup', {
...
ui: batchSDKUIConfig
});