Код: Выделить всё
self.addEventListener("notificationclick", function (event) {
event.preventDefault();
let url = "https://origin/specific-path";
event.notification.close();
event.waitUntil(
self.clients.matchAll({ type: "window", includeUncontrolled: true })
.then((clientsArray) => {
// Code for navigating an open PWA omitted.
// One of the tried strategies.
return clients
.openWindow(notificationURL)
.then(function (newClient) {
newClient.navigate(notificationURL);
});
// Another of the tried strategies.
self.clients
.openWindow(url)
.then((windowClient) => (windowClient ? windowClient.focus() : null));
})
);
Примечание: Я думаю, что эта проблема отделен от других потоков здесь, потому что это специально для открытия конкретного URL , когда PWA закрыт .>
Подробнее здесь: https://stackoverflow.com/questions/793 ... url-when-o