OneSignal-Website-SDK icon indicating copy to clipboard operation
OneSignal-Website-SDK copied to clipboard

Hide notification if website is active

Open gijo-varghese opened this issue 6 years ago • 9 comments

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

gijo-varghese avatar Jan 17 '18 17:01 gijo-varghese

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.

jasonpang avatar Jan 19 '18 04:01 jasonpang

Ok

gijo-varghese avatar Jan 19 '18 04:01 gijo-varghese

Hey @jasonpang, any plans to support this feature soon?

lidanh avatar Mar 28 '18 10:03 lidanh

@jasonpang any news about this feature?

munaretto avatar Jul 05 '19 19:07 munaretto

any news about this feature?

kauly avatar Aug 31 '20 15:08 kauly

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.

tenbits avatar Nov 29 '20 20:11 tenbits

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.

@tenbits Have you got any solution to above issue?

chetansatasiya avatar Sep 05 '22 06:09 chetansatasiya

@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.

tenbits avatar Sep 05 '22 19:09 tenbits

is there any update on this feature request?

bboure avatar May 22 '23 16:05 bboure