From eee098e723fc4d97b1af692df952d0abde989e07 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Thu, 11 Oct 2018 00:08:07 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20use=20ServiceWorker=20on=20iOS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/scripts/ui.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/scripts/ui.js b/client/scripts/ui.js index ccb53f8..0722236 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -3,6 +3,7 @@ const $$ = query => document.body.querySelector(query); const isURL = text => /^((https?:\/\/|www)[^\s]+)/g.test(text.toLowerCase()); window.isDownloadSupported = (typeof document.createElement('a').download !== 'undefined'); window.isProductionEnvironment = !window.location.host.startsWith('localhost'); +window.iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; class PeersUI { @@ -457,7 +458,8 @@ document.copy = text => { } -if ('serviceWorker' in navigator) { +if ('serviceWorker' in navigator && !window.iOS) { + // SW on iOS is buggy. see: https://stackoverflow.com/questions/18103103/failed-to-load-resource-plugin-handled-load-on-ios navigator.serviceWorker .register('/service-worker.js') .then(serviceWorker => {