Skip to content

getResult(): IResult

Get all information regarding browser, CPU, device, engine, & OS from user-agent string.

Properties of IResult:

js
// Result object is structured as follow:
{ 
    ua: "", 
    browser: { 
        name: "", 
        version: "",
        major: "",
        type: ""
    }, 
    cpu: {
        architecture: ""
    }, 
    device: {
        vendor: "",
        model: "",
        type: ""
    }, 
    engine: {
        name: "",
        version: ""
    }, 
    os: {
        name: "",
        version: ""
    }
}

ua: string

The user-agent string value of current instance.

browser: IBrowser

Object that contains the value of browser name, full version, & major version.

cpu: ICPU

Object that contains the value of type of CPU architecture.

device: IDevice

Object that contains the value of device details: type, vendor, model.

engine: IEngine

Object that contains the value of layout rendering engine name & version.

os: IOS

Object that contains the value of operating system name & version.

Methods of IResult

Inherited from IData:

Code Example

js
const galaxytabs8 = 'Mozilla/5.0 (Linux; Android 12; SM-X706B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36'
const parser = new UAParser(galaxytabs8);

console.log(parser.getResult());
/*
{ 
    ua: "Mozilla/5.0 (Linux; Android 12; SM-X706B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36", 
    browser: { 
        name: "Chrome", 
        version: "103.0.5060.53",
        major: "103"
    }, 
    cpu: {
        architecture: undefined
    }, 
    device: {
        type: "mobile",
        vendor: "Huawei",
        model: "SM-X706B"
    },
    engine: {
        name: "Blink",
        version: "103.0.5060.53"
    }, 
    os: {
        name: "Android",
        version: "12"
    }
}
*/

UAParser.js v2 is licensed under AGPLv3 or PRO licenses.