I have a Service Worker of firebase messaging with this listener:
self.addEventListener('notificationclick', function(event) {
const url = dispatchNotification(event.notification.data);
event.notification.close();
const appUrl = `${url}`;
event.waitUntil(clients.matchAll({
type: 'window',
includeUncontrolled: true
}).then( activeClients => {
if (activeClients.length > 0) {
activeClients[0].navigate(appUrl).then(client => client.focus());
} else {
clients.openWindow(appUrl);
}
})
);
});
In Firefox the redirection works perfectly, but in chrome it throw's a error like this:
Uncaught (in promise) TypeError: Cannot navigate to URL: http://localhost:4100/urlParams
Any idea why it can works perfectly fine in firefox and throw the error in chrome? localhost it's a secure url so can't be the ssl restriction.
The notification is showed correctly the only problem is the redirection to the tab.