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)
}
参考
阅读 473 · 发布于 2021-06-24
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Golang 设置 GOROOT 和 GOPATH阅读 3705
-
SQL 注入和 XSS 攻击阅读 2307
-
VisualVM 中的 OQL 语句查询阅读 1840
-
JavaScript/PHP 判断是否为微信内置浏览器阅读 2728
-
软考-系统架构设计师:面向对象设计阅读 1342
-
Test.class found in top-level directory (unnamed package not allowed in module)阅读 3373
-
MySQL 查询去重阅读 1875
-
Windows 查看是否是固态硬盘阅读 1338
-
自定义 Spring Boot Starter 中的组件无法被 Spring 扫描注册阅读 266
-
Vue 透传 Attribute阅读 75