xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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

https://moon.swatch.cn/#/

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, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(45)  评论(4编辑  收藏  举报
相关博文:
阅读排行:
· 无需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 评测&对比!
点击右上角即可分享
微信分享提示