-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5417b66
commit f683afa
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 检查浏览器版本是否符合要求 | ||
* 如果不符合要求,弹出提示框 | ||
*/ | ||
export default function checkBrowser() { | ||
const ua = navigator.userAgent | ||
const chrome = ua.match(/Chrome\/(\d+)/) | ||
const firefox = ua.match(/Firefox\/(\d+)/) | ||
const edge = ua.match(/Edge\/(\d+)/) | ||
const safari = ua.match(/Safari\/(\d+)/) | ||
if ( | ||
(chrome && Number(chrome[1]) < 108) || | ||
(firefox && Number(firefox[1]) < 101) || | ||
(edge && Number(edge[1]) < 108) || | ||
(safari && Number(safari[1]) < 15.4) | ||
) { | ||
alert(` | ||
您的浏览器版本过低 | ||
可能无法正常使用本应用 | ||
建议使用最新版本 | ||
Chrome/Edge/Firefox/Safari | ||
等现代浏览器 | ||
`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters