Skip to content

Commit 3b31a83

Browse files
committed
[ServiceWorler fix] - Failed to get a ServiceWorkerRegistration error.
1 parent 3d0a10d commit 3b31a83

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/javascript/controllers/notifications_controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export default class extends Controller {
6060
}
6161

6262
get #serviceWorkerRegistration() {
63-
return navigator.serviceWorker.getRegistration(window.location.host)
63+
const hostAndProtocol = window.location.protocol + '//' + window.location.host;
64+
return navigator.serviceWorker.getRegistration(hostAndProtocol)
6465
}
6566

6667
#registerServiceWorker() {

0 commit comments

Comments
 (0)