refactor: extract detect-ie.js

This commit is contained in:
pany 2024-11-04 17:37:43 +08:00
parent 8523ec6695
commit bc0c8f4cc4
2 changed files with 6 additions and 7 deletions

View File

@ -6,18 +6,12 @@
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="/app-loading.css" />
<title>%VITE_APP_TITLE%</title>
<script src="/detect-ie.js" defer></script>
</head>
<body>
<div id="app">
<div id="app-loading"></div>
</div>
<script>
// Tip: Simple judgments may not fully cover
if (/MSIE\s|Trident\//.test(window.navigator.userAgent)) {
document.body.innerHTML =
"<strong>Sorry, this browser is currently not supported. We recommend using the latest version of a modern browser. For example, Chrome/Firefox/Edge.</strong>"
}
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

5
public/detect-ie.js Normal file
View File

@ -0,0 +1,5 @@
// Tip: Simple judgments may not fully cover
if (/MSIE\s|Trident\//.test(window.navigator.userAgent)) {
document.body.innerHTML =
"<strong>Sorry, this browser is currently not supported. We recommend using the latest version of a modern browser. For example, Chrome/Firefox/Edge.</strong>"
}