Skip to content

Firebase messaging site navigation not working when notification is “hidden” in notifications center (windows 10) #3271

Closed
@freerider7777

Description

@freerider7777

[REQUIRED] Describe your environment

  • Operating System version: Windows 10
  • Browser version: Chrome Version 83.0.4103.116 (Official Build) (64-bit)
  • Firebase SDK version: 7.15.4 (lower the same)
  • Firebase Product: messaging

[REQUIRED] Describe the problem

Getting a token, receiving a notification works ok. The page must be active. When you click notification with the link immediately when it is shown it opens the site. But if you wait for the notification to "hide" in notifications center (right lower corner in windows 10) the click does not pass to the site (service worker is not called).

Steps to reproduce:

Here is a demo project (not my) https://peter-gribanov.github.io/serviceworker/ When you click Register you receive an FCM token. After that you can send yourself a browser push notification (click Send). It shows just fine and if you click immediately it opens the site. But if you wait for the notification to "hide" in notifications center the click does not pass to the site (service worker is not called), just disappers. On the page the notification is shown like this:

Relevant Code:

    navigator.serviceWorker.register('/serviceworker/firebase-messaging-sw.js');
    Notification.requestPermission(function(permission) {
        if (permission === 'granted') {
            navigator.serviceWorker.ready.then(function(registration) {
              // Copy data object to get parameters in the click handler
              payload.data.data = JSON.parse(JSON.stringify(payload.data));

              registration.showNotification(payload.data.title, payload.data);
            }).catch(function(error) {
                // registration failed :(
                showError('ServiceWorker registration failed', error);
            });
        }
    });

(The source code is here https://github.com/peter-gribanov/serviceworker/blob/master/app.js)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions