Skip to content

Commit

Permalink
Update demo.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-Huang1 authored Jan 3, 2025
1 parent fa21739 commit 41a48d0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@
}

state(18, 8)

function isOldBrowser() {
// 检测一些浏览器支持的现代功能
const isModernBrowser = () => {
return 'fetch' in window && 'Promise' in window && 'assign' in Object && 'includes' in Array.prototype;
};

// 检查 User-Agent 字符串中是否包含一些已知的老旧浏览器标识
const userAgent = navigator.userAgent.toLowerCase();
const isOldBrowserByUA = /msie|trident|edge\/(1|12)/.test(userAgent);

return !isModernBrowser() || isOldBrowserByUA;
}

if (isOldBrowser()) {
alert("您的浏览器可能过时,某些功能可能无法正常使用。请考虑升级浏览器。");
}

</script>
</div>
</body>
Expand Down

0 comments on commit 41a48d0

Please sign in to comment.