From 9af72c3ec201a6ab8b53bcbae644fa8549a609d7 Mon Sep 17 00:00:00 2001 From: Arktos Date: Tue, 1 Sep 2020 19:54:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9https=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=88=A4=E6=96=AD=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=9C=A8?= =?UTF-8?q?http=E9=A1=B5=E9=9D=A2=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#7280)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix issus #7275 * Update src/global.tsx Co-authored-by: 偏右 * Update src/global.tsx Co-authored-by: 陈帅 Co-authored-by: 偏右 Co-authored-by: 陈帅 --- src/global.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/global.tsx b/src/global.tsx index 108e2017..5e355036 100644 --- a/src/global.tsx +++ b/src/global.tsx @@ -5,6 +5,7 @@ import { useIntl } from 'umi'; import defaultSettings from '../config/defaultSettings'; const { pwa } = defaultSettings; +const isHttps = document.location.protocol === 'https:'; // if pwa is true if (pwa) { @@ -59,7 +60,7 @@ if (pwa) { onClose: async () => {}, }); }); -} else if ('serviceWorker' in navigator) { +} else if ('serviceWorker' in navigator && isHttps) { // unregister service worker const { serviceWorker } = navigator; if (serviceWorker.getRegistrations) {