fix: enhance service worker registration to ensure it only occurs over secure protocols (http/https)
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user