How to detect browser / User-Agent in Node.js#
Whether you are using a bare bones Node.js HTTP server or Express, the browser user agent information can be found in the
User-Agent HTTP request header.
The request object is popularly named
req, so the user agent information can be found at
With many browsers and versions, browser detection is a very nuanced task. If you are looking for fine control about the details you detect, you should use the ua-parser module.
User-Agentheader can be easily faked.