From f55b0e27b4162603228f420b2f375d09c9f20f2e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 18 Jul 2024 12:10:08 +0200 Subject: [PATCH] js: Don't crash UI in case of non-https connections --- public/js/notifications.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/js/notifications.js b/public/js/notifications.js index a50d9a98..d4c43164 100644 --- a/public/js/notifications.js +++ b/public/js/notifications.js @@ -20,6 +20,12 @@ const VERSION = 1; return; } + if (! navigator.serviceWorker) { + console.error(LOG_PREFIX + "this browser does not support the 'Service Worker API' in the current context"); + + return; + } + if (! 'Notification' in self) { console.error(LOG_PREFIX + "this browser does not support the 'Notification API' in the current context");