Disable service worker on Apple devices for now.

The service worker is not used for any features
on Apple devices and we've received multiple reports
of service workers causing problems.
This commit is contained in:
Guo Xiang Tan 2018-07-09 11:32:33 +08:00
parent 0ab42e9185
commit 6d0732f7b4

View File

@ -7,10 +7,11 @@ export default {
location.hostname === "localhost";
const isSupported = isSecured && "serviceWorker" in navigator;
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
if (isSupported) {
if (Discourse.ServiceWorkerURL && !isSafari) {
const isApple = !!navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i);
if (Discourse.ServiceWorkerURL && !isApple) {
navigator.serviceWorker.getRegistrations().then(registrations => {
for (let registration of registrations) {
if (