From 3b31a83ac5ca5dbcfbce75454e1193762becbc47 Mon Sep 17 00:00:00 2001 From: milos-dukic Date: Mon, 15 Sep 2025 15:21:04 +0200 Subject: [PATCH] [ServiceWorler fix] - Failed to get a ServiceWorkerRegistration error. --- app/javascript/controllers/notifications_controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/notifications_controller.js b/app/javascript/controllers/notifications_controller.js index 1913c0e..e585f70 100644 --- a/app/javascript/controllers/notifications_controller.js +++ b/app/javascript/controllers/notifications_controller.js @@ -60,7 +60,8 @@ export default class extends Controller { } get #serviceWorkerRegistration() { - return navigator.serviceWorker.getRegistration(window.location.host) + const hostAndProtocol = window.location.protocol + '//' + window.location.host; + return navigator.serviceWorker.getRegistration(hostAndProtocol) } #registerServiceWorker() {