diff --git a/src/platform/web/dom/ServiceWorkerHandler.js b/src/platform/web/dom/ServiceWorkerHandler.js index d2dacc6b..dd2c755f 100644 --- a/src/platform/web/dom/ServiceWorkerHandler.js +++ b/src/platform/web/dom/ServiceWorkerHandler.js @@ -76,6 +76,8 @@ export class ServiceWorkerHandler { // this flag is read in fetch.js this.haltRequests = true; event.source.postMessage({replyTo: data.id}); + } else if (data.type === "openRoom") { + this._navigation.push("room", data.payload.roomId); } } diff --git a/src/platform/web/service-worker.js b/src/platform/web/service-worker.js index 335930bb..29b124d9 100644 --- a/src/platform/web/service-worker.js +++ b/src/platform/web/service-worker.js @@ -201,9 +201,8 @@ async function openClientFromNotif(event) { }); if (clientWithSession) { console.log("notificationclick: client has session open, showing room there"); - // just change the hash, so the page doesn't refresh on / vs /index.html - const roomURL = new URL(roomHash, clientWithSession.url).href; - clientWithSession.navigate(roomURL); + // use a message rather than clientWithSession.navigate here as this refreshes the page on chrome + clientWithSession.postMessage({type: "openRoom", payload: {roomId}}); if ('focus' in clientWithSession) { try { await clientWithSession.focus();