Check if a visitor's browser is new enough to support a feature before showing it, and display a warning or fallback if not.
On a Node.js server, detect the visitor's device type before responding so you can serve a mobile-optimized page.
Set per-platform browser version rules, such as requiring Safari 10.1+ on desktop but only 9+ on mobile, using the satisfies filter.
Improve browser detection accuracy for Chromium-based browsers by reading User-Agent Client Hints when available.
Install via npm, then import and call Bowser.parse(navigator.userAgent) or use the satisfies method. Works in browser and Node.js with no configuration needed.
Bowser is a small JavaScript library that figures out which browser, operating system, and device type a visitor is using. When a user visits a website, their browser sends a string of text called a user agent that describes itself. Bowser reads that string and turns it into structured, easy-to-query data covering the browser name and version, the operating system name and version, the platform type (desktop, mobile, or tablet), and the rendering engine. The library is designed to work in both browser-based JavaScript and in Node.js, so it can be used on the client side (in the page itself) or on the server side (to make decisions before sending a response). It is small, around 4.8 kilobytes when compressed for transfer, and it only runs the parsing code needed for the questions you actually ask, so it does not waste time analyzing information you will not use. One of its more practical features is a filter function called satisfies. You pass it a set of rules describing browser versions you want to support, and it tells you whether the current visitor's browser meets those criteria. Rules can be scoped to a specific operating system or platform, so you can say things like "Safari must be version 10.1 or newer on macOS, but version 9 or newer on mobile." This is useful for deciding whether to show a feature, display a warning, or load a compatibility fallback. The library also supports a newer browser API called User-Agent Client Hints, which some modern browsers provide as a more privacy-aware alternative to the traditional user agent string. When that data is available, Bowser can use it to improve detection accuracy, particularly for browsers built on top of the Chromium engine that share similar user agent strings. Installation is through npm, and the library supports CommonJS, ES6 module, and TypeScript import styles.
← bowser-js on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.