···2525 location.href = location.href.replace("http://", "https://")
2626}
27272828-// Service worker
2929-if ("serviceWorker" in navigator) {
2828+// Secure context & Service worker
2929+if (!self.isSecureContext) {
3030+ failure(`
3131+ This app only works on a <a class="underline" target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#When_is_a_context_considered_secure">secure context</a>, HTTPS & localhost, and modern browsers.
3232+ `)
3333+3434+} else if ("serviceWorker" in navigator) {
3035 navigator.serviceWorker.register("service-worker.js").then(
3136 initialise,
3237 () => failure(
···3540 : "Failed to start the service worker, try using HTTPS."
3641 )
3742 )
3838-} else {
3939- failure("We'll need a more modern browser to liven the place up a bit.")
4343+4044}
41454246