DEV: Add param that allows service worker to be removed.
This commit is contained in:
parent
72a3457379
commit
cb12f462a2
|
@ -7,10 +7,17 @@ export default {
|
||||||
location.hostname === "localhost";
|
location.hostname === "localhost";
|
||||||
|
|
||||||
const isSupported = isSecured && "serviceWorker" in navigator;
|
const isSupported = isSecured && "serviceWorker" in navigator;
|
||||||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
||||||
|
|
||||||
if (isSupported) {
|
if (isSupported) {
|
||||||
if (Discourse.ServiceWorkerURL && !isSafari) {
|
const isSafari = /^((?!chrome|android).)*safari/i.test(
|
||||||
|
navigator.userAgent
|
||||||
|
);
|
||||||
|
|
||||||
|
const disableServiceWorker = window.location.search.includes(
|
||||||
|
"disable_service_worker"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Discourse.ServiceWorkerURL && !isSafari && !disableServiceWorker) {
|
||||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||||
for (let registration of registrations) {
|
for (let registration of registrations) {
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue