fix: enhance service worker registration to ensure it only occurs over secure protocols (http/https)

This commit is contained in:
2025-12-31 18:59:24 -06:00
parent 59536df2ff
commit aea77cb4b6

View File

@@ -21,7 +21,11 @@
}
onMount(() => {
if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {
if (
typeof window !== 'undefined' &&
'serviceWorker' in navigator &&
(window.location.protocol === 'http:' || window.location.protocol === 'https:')
) {
navigator.serviceWorker
.register('/sw.js')
.then((reg) => {