Allow each window to handle notification click without service worker #224
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
What problem are you trying to solve?
During internal discussion about declarative notification activation handling, we thought it could be useful to let webpages handle notification click without having to depend on service worker, as we are interested in reducing service worker use (to reduce complexity).
What solutions exist today?
Webpages need to deploy a service worker to listen on notificationclick and iterate on window clients to navigate/focus/open window.
e.g in Mastodon: https://github.com/mastodon/mastodon/blob/37bcbeab4aead09c4884827b8a7625c5070ab192/app/javascript/mastodon/service_worker/web_push_notifications.js#L175-L184
How would you solve it?
(rough idea) Define a notification event handler on window, on which the event can request navigation:
or the event can be a signal that the page will soon be navigated:
Anything else?
It's kinda parallel to the current version of #213 as it doesn't fire click event at all if navigation URL is given and depends on unspecified browser internal algorithm to select which tab is to be navigated. This one would provide a way for each website to decide where the navigation should happen.
It could also be solved with SW notificationclick, if we set the default behavior to "open new tab" and let "preventDefault()" to not open a new tab and let SW customize the behavior as websites already do.
The text was updated successfully, but these errors were encountered: