how to tell whether website visitors from the mobile browser environment in js All In One
how to tell whether website visitors from the mobile browser environment in js All In One
platform ✅
navigator.platform;
// 'MacIntel'
macOS
{
"archPlatform": "MacIntel",
"navigator": {}
}
iOS
{
"archPlatform": "iPhone",
"navigator": {}
}
iPadOS
{
"archPlatform": "iPad",
"navigator": {}
}
Andriod
{
"archPlatform": "Linux armv81",
"navigator": {}
}
UA ❌
https://cdn.xgqfrms.xyz/UA/index.html
macOS
{
"os": "macOS",
"osVersion": "10.15.7",
"browser": "Chrome",
"browserVersion": "101.0.4929.5",
"engine": "WebKit",
"platform": "Desktop",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4929.5 Safari/537.36",
"screenSize": {
"width": 1920,
"height": 1080
}
}
iOS
{
"os": "iOS",
"osVersion": "15.4",
"browser": "Chrome",
"browserVersion": "99.0.4844.59",
"engine": "WebKit",
"platform": "Mobile",
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/99.0.4844.59 Mobile/15E148 Safari/604.1",
"screenSize": {
"width": 390,
"height": 844
}
}
WX
{
"os": "iOS",
"osVersion": "15.4",
"browser": "微信浏览器",
"browserVersion": "8.0.16",
"engine": "WebKit",
"platform": "Mobile",
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x18001023) NetType/WIFI Language/zh_CN",
"screenSize": {
"width": 390,
"height": 844
}
}
demo
Mobile 模拟器
navigator.userAgent;
// 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
navigator.userAgent;
// 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x18001023) NetType/WIFI Language/zh_CN'
refs
©xgqfrms 2012-2025
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16070593.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
2021-03-29 页面超过 10 分钟没有任何操作
2021-03-29 node.js ECONNRESET error
2020-03-29 ROI
2020-03-29 React & Calendar
2020-03-29 taro & Block
2020-03-29 taro swiper & scroll tabs
2016-03-29 读写 LED 作业 台灯的 频闪研究 2 评测&对比!