Most implementations i\'ve seen are for browser detection on the client side. I was just wondering if it was possible to do browser detection before sending any resources to
I released device-detector-js a couple months ago.
It's a TypeScript port of Matomo device-detector, a powerful device detection library originally written in PHP.
It can parse any user agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
Installation
npm install device-detector-js
Example - simple user agent detection:
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);
Take a look at the full API documentation.