faisalman / ua-parser-js

UAParser.js - The Essential Web Development Tool for User-Agent Detection.
https://uaparser.dev/
GNU Affero General Public License v3.0
9.08k stars 1.19k forks source link

HoloLens detection? #529

Closed jparismorgan closed 1 year ago

jparismorgan commented 2 years ago

Hi there, I'm wondering if anyone has looked at detecting HoloLens devices from their user agent? Here is a sample user agent from a HoloLens 2 running Edge:

Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Edg/93.0.961.52

I see in browser-test.json the following user agents for desktop, iOS, and Android Edge. It looks like the main differentiator between them and HoloLens is that HoloLens only has Windows NT 10.0, whereas the others have Windows NT 10.0; foo. Perhaps we could use that to differentiate HoloLens?

{
        "desc"    : "Microsoft Edge 0.1",
        "ua"      : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0",
        "expect"  :
        {
            "name"    : "Edge",
            "version" : "12.0",
            "major"   : "12"
        }
    },
    {
        "desc"    : "Microsoft Edge 42",
        "ua"      : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134",
        "expect"  :
        {
            "name"    : "Edge",
            "version" : "17.17134",
            "major"   : "17"
        }
    },
    {
        "desc"    : "Microsoft Edge 44",
        "ua"      : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763",
        "expect"  :
        {
            "name"    : "Edge",
            "version" : "18.17763",
            "major"   : "18"
        }
    },
    {
        "desc"    : "Microsoft Edge on iOS",
        "ua"      : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 EdgiOS/42.1.1.0 Mobile/15F79 Safari/605.1.15",
        "expect"  :
        {
            "name"    : "Edge",
            "version" : "42.1.1.0",
            "major"   : "42"
        }
    },
    {
        "desc"    : "Microsoft Edge on Android",
        "ua"      : "Mozilla/5.0 (Linux; Android 8.0.0; G8441 Build/47.1.A.12.270) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.123 Mobile Safari/537.36 EdgA/42.0.0.2529",
        "expect"  :
        {
            "name"    : "Edge",
            "version" : "42.0.0.2529",
            "major"   : "42"
        }
    },
    {
        "desc"    : "Microsoft Edge Chromium",
        "ua"      : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.48 Safari/537.36 Edg/74.1.96.24",
        "expect"  :
        {
            "name"    : "Edge",
            "version" : "74.1.96.24",
            "major"   : "74"
        }
    },
faisalman commented 1 year ago

In this current situation, it seems too general to conclude something specific. There may be other devices with the same pattern, which can produce false positive result.