getDevice(): IDevice
Get details of device information (type, vendor, model) from user-agent string.
Properties of IDevice
js
// Device object is structured as follow:
{
type: "",
vendor: "",
model: ""
}
type?: string
INFO
See list of possible device type here.
vendor?: string
INFO
See list of possible device vendor here.
model?: string
Determined dynamically.
Methods of IDevice
Inherited from IData
:
is(value: string): boolean
toString(): string
withClientHints<IDevice>(): PromiseLike<IDevice> | IDevice
withFeatureCheck<IDevice>(): PromiseLike<IDevice> | IDevice
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" }