diff --git a/src/hub.js b/src/hub.js index a6cb4084259c25a9d5f50cbab54e60956cde7526..6d5a92b4da7958fc165ab3c93f4e77718237ac77 100644 --- a/src/hub.js +++ b/src/hub.js @@ -292,10 +292,14 @@ document.addEventListener("DOMContentLoaded", async () => { const subscriptions = new Subscriptions(hubId); if (navigator.serviceWorker) { - navigator.serviceWorker.register("/hub.service.js"); - navigator.serviceWorker.ready - .then(registration => subscriptions.setRegistration(registration)) - .catch(() => subscriptions.setRegistrationFailed()); + try { + navigator.serviceWorker.register("/hub.service.js"); + navigator.serviceWorker.ready + .then(registration => subscriptions.setRegistration(registration)) + .catch(() => subscriptions.setRegistrationFailed()); + } catch (e) { + subscriptions.setRegistrationFailed(); + } } const scene = document.querySelector("a-scene");