OneSignal-Website-SDK
OneSignal-Website-SDK copied to clipboard
Hide notification if website is active
I'm using Onesignal push notification to send message. But for now even if user has opened the website it will show the notification. Is there any way to hide it? Display notifications only when he is not inside the website
Hi @gijo-varghese,
Chrome requires sites to show a notification unless the site is visible in the foreground (not just as an open inactive tab, but as the active open tab). Even if the site is visible in the foreground and notification display is optional, our service worker does not currently support conditionally displaying notifications and will always display a visible notification for a sent push message.
We've labeled this as a feature request to revisit this in the future.
Ok
Hey @jasonpang, any plans to support this feature soon?
@jasonpang any news about this feature?
any news about this feature?
Still no progress on this? For chat applications it is quit annoying for the user, when he/she is actively chatting, but still sees all the push notifications. Are there some workaround, for example by disabling notifications using setSubscription
and Page Visibility API? We do not go this workaround, as having consideration for the case, when the user closes browser, and we don't manage to un-mute
the notifications and the user won't receive any notifications then.
Still no progress on this? For chat applications it is quit annoying for the user, when he/she is actively chatting, but still sees all the push notifications. Are there some workaround, for example by disabling notifications using
setSubscription
and Page Visibility API? We do not go this workaround, as having consideration for the case, when the user closes browser, and we don't manage toun-mute
the notifications and the user won't receive any notifications then.
@tenbits Have you got any solution to above issue?
@chetansatasiya We use Cordova SDK, and there is OSInFocusDisplayOption.None
option.
oneSignal
.startInit(opts.appId)
.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.None)
Unfortunately, I don't remember if we have fixed or had a workaround for the web version.
is there any update on this feature request?