I recently released the JS detector device a couple of months ago.
This is the TypeScript port of the Matomo device discovery device, a powerful device discovery library originally written in PHP.
He can analyze any user agent and determine the browser, operating system, device used (desktop, tablet, mobile phone, TV, cars, console, etc.), make and model.
It has been thoroughly tested and uses over 6,000 tests to detect thousands of different devices.
Mounting
npm install device-detector-js
An example is a simple user agent discovery:
const DeviceDetector = require("device-detector-js"); const deviceDetector = new DeviceDetector(); const userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"; const device = deviceDetector.parse(userAgent); console.log(device);
Check out the full API documentation .
Etienne Martin Dec 11 '18 at 20:37 2018-12-11 20:37
source share