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-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-03-29 10:40  xgqfrms  阅读(45)  评论(4编辑  收藏  举报