Function getBrowserInfo

  • EN: Browser Information

    ZH: 返回浏览器信息 https://github.com/JowayYoung/juejin-code/blob/master/browser-type.js

    Usage:

    const ret = getBrowserInfo();
    console.log(ret);

    Output:

    {"engine":"webkit","engineVs":"537.36","platform":"desktop","supporter":"chrome","supporterVs":"85.0.4183.121","system":"windows","systemVs":"10"}
    

    Results:

    Attribute Description Type Values
    system System string android, ios, windows, macos, linux
    systemVs System version string Windows: 2000, xp, 2003, vista, 7, 8, 8.1, 10 macOS: ...
    platform Platform string desktop, mobile
    engine Engine string webkit, gecko, presto, trident
    engineVs Engine version string -
    supporter Supporter string edge, opera, chrome, safari, firefox, iexplore
    supporterVs Supporter version string -
    shell Shell string (Optional) wechat, qq_browser, qq_app, uc, 360, 2345, sougou, liebao, maxthon, bilibili
    shellVs Shell version string (Optional) 20/...
    appleType Apple device type string (Optional) ipad, iphone, ipod, iwatch

    Example: Determine the environment of the mobile QQ.

    const { system, shell } = getBrowserInfo();
    const isMobileQQ = ['android', 'ios'].includes(system) && ['qq_browser', 'qq_app'].includes(shell);

    Returns BrowserInfo

    浏览器信息