JS-判断设备操作系统是Andorid还是IOS
使用current-device.min.js判断设备操作系统是Andorid还是IOS。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://unpkg.com/current-device/umd/current-device.min.js"></script>
</head>
<body>
</body>
<script>
console.log(device.mobile());
console.log(device.ios())
console.log(device.android())
</script>
</html>
此js库体积非常小,只有1.7kb,在判断设备后会在html标签,添加对应信息,详见官方doc。
github地址:
https://github.com/matthewhudson/current-device
还没有评论,来说两句吧...