@samitouri / QOSami-HFS / commits / b0662576

shorter loading message if a modern browser is detected #840

Massimo Melina committed Dec 22, 2024 at 12:10 UTC b066257629ee97730a81e9c8534d44b4ff49ce3a
1 file changed +12
frontend/index.html
+12
@@ -9,5 +9,17 @@
9 <body>
10 <style class="removeAtBoot">@media (prefers-color-scheme: dark) { html { background-color: #000; color: #888; } }</style>
11 <div id="root">Wait for loading or <a href="?get=basic">use basic interface now</a></div>
12 + <script>
13 + function isModernBrowser() { // support BigInt
14 + const ua = navigator.userAgent
15 + return /Chrome\/(\d+)/.exec(ua)?.[1] >= 67 ||
16 + /Edg\/(\d+)/.exec(ua)?.[1] >= 79 ||
17 + /Firefox\/(\d+)/.exec(ua)?.[1] >= 68 ||
18 + /OPR\/(\d+)/.exec(ua)?.[1] >= 54 ||
19 + /Version\/(\d+).+Safari/.exec(ua)?.[1] >= 14
20 + }
21 + if (isModernBrowser())
22 + document.getElementById('root').innerHTML = 'Loading...'
23 + </script>
24 </body>
25 </html>