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

昵称:
随便看看
换一批
-
软考-系统架构设计师:客户关系管理(CRM)阅读 1851
-
JavaScript Date 时间函数阅读 759
-
Spring Boot OpenFeign PATCH 请求报错:java.net.ProtocolException: Invalid HTTP method: PATCH阅读 310
-
MySQL 之 Windows 免安装版本配置环境阅读 1871
-
短信开发之行业短信阅读 1319
-
使用 Chrome 进行网页长截图阅读 2425
-
MyBatis BindingException 绑定异常阅读 1055
-
Spring Boot JPA 使用 @Index 为字段添加索引阅读 392
-
PostgreSQL 使用 \copy 命令时报 character with byte sequence 0xc3 0xa5 in encoding "UTF8" has no equivalent in encoding "GBK"阅读 8973
-
Linux CentOS6 安装 Docker阅读 4525