function detectOS() {
navigator.userAgent;
return navigator.platform
}
document.writeln("您的操作系统是:" + detectOS());
if(detectOS().match(/Win|Linux|MAC/i)){
document.writeln("<br> 请使用移动设备访问");
}js获取设备操作系统
最新推荐文章于 2025-03-27 20:58:18 发布
本文提供了一段简单的JavaScript代码,用于检测用户当前所使用的操作系统类型,并根据检测结果给出提示信息。该代码通过读取浏览器的navigator.userAgent属性来判断是否为移动设备。
581

被折叠的 条评论
为什么被折叠?



