don't include url fragment in client url check

This commit is contained in:
liamcottle
2025-02-13 19:17:09 +13:00
parent 988ed780fd
commit 6ece7fa137

View File

@@ -26,13 +26,14 @@ self.addEventListener('notificationclick', function(event) {
});
const findClientForUrl = function(url) {
const findClientForUrl = function(urlToOpen) {
return self.clients.matchAll({
type: "window",
includeUncontrolled: true,
}).then(function (clientList) {
return clientList.find(function(client) {
return client.url.endsWith(url);
const [ clientUrlWithoutFragment ] = client.url.split("#");
return clientUrlWithoutFragment.endsWith(urlToOpen);
});
});
};