JavaScript 判断 Android 还是 iOS
JavaScript 大约 442 字Android
function android() {
return /Android/i.test(navigator.userAgent)
}
iOS
function iOS() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
参考
阅读 760 · 发布于 2021-06-24
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓
昵称:
随便看看
换一批
-
查看保存过但显示为星号的密码阅读 5101
-
软考-系统架构设计师:物联网 IoT阅读 1735
-
YAML 基础语法阅读 801
-
不安装 redis-server 下连接 redis阅读 3194
-
Linux zgrep,zcat,zless,zmore 等 zutil 包命令阅读 4181
-
使用 trivy 扫描 Docker 镜像、K8S 集群的安全漏洞阅读 1823
-
Prometheus+Grafana+nginx-prometheus-exporter 监控 Nginx阅读 4216
-
PostgreSQL distinct 和 distinct on 区别阅读 1882
-
GitHub OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443阅读 6354
-
Spring Boot 使用 Session 管理登录状态和拦截请求阅读 10648