Skip to content

UAParser : getDevice()

getDevice(): IDevice

Returns the device details (type, vendor, model).

IDevice

Properties

js
{ 
    type: "", 
    vendor: "", 
    model: "" 
}

type?: string

The detected device type (e.g. mobile, tablet, smarttv, wearable).

INFO

See list of possible device types here.


vendor?: string

The device manufacturer (e.g. Samsung, Apple, Huawei).

INFO

See list of possible device vendors here.


model?: string

The detected model name, determined dynamically from the user-agent string.

Methods

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.getDevice());
// { type : "tablet", vendor : "Samsung", model : "SM-X706B" }

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