未验证 提交 9af72c3e 编写于 作者: A Arktos 提交者: GitHub

增加对https环境判断,解决在http页面报错的问题 (#7280)

* fix issus #7275

* Update src/global.tsx
Co-authored-by: N偏右 <afc163@gmail.com>

* Update src/global.tsx
Co-authored-by: N陈帅 <qixian.cs@outlook.com>
Co-authored-by: N偏右 <afc163@gmail.com>
Co-authored-by: N陈帅 <qixian.cs@outlook.com>
上级 8eb75223
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册