explaingit

bowser-js/bowser

5,735JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

Bowser is a tiny JavaScript library that detects a visitor's browser, operating system, and device type from the user agent string, turning it into clean, queryable data you can use to conditionally load features or show compatibility warnings.

Mindmap

mindmap
  root((repo))
    What it does
      Detects browser name
      Detects OS version
      Detects device type
      Parses user agent
    Key Features
      satisfies filter
      Client Hints support
      Lazy parsing
    Tech Stack
      JavaScript
      Node.js support
      TypeScript types
    Use Cases
      Feature gating
      Compatibility warnings
      Server side detection
    Audience
      Frontend devs
      Node.js devs
      Web app builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Check if a visitor's browser is new enough to support a feature before showing it, and display a warning or fallback if not.

USE CASE 2

On a Node.js server, detect the visitor's device type before responding so you can serve a mobile-optimized page.

USE CASE 3

Set per-platform browser version rules, such as requiring Safari 10.1+ on desktop but only 9+ on mobile, using the satisfies filter.

USE CASE 4

Improve browser detection accuracy for Chromium-based browsers by reading User-Agent Client Hints when available.

Tech stack

JavaScriptNode.jsTypeScriptnpmCommonJSES6 modules

Getting it running

Difficulty · easy Time to first run · 5min

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.

The license was not mentioned in the explanation.

In plain English

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.

Copy-paste prompts

Prompt 1
Using the bowser npm package, write a JavaScript function that checks if the current user's browser satisfies Chrome 90+ on desktop or Safari 14+ on iOS, and returns true or false.
Prompt 2
Show me how to use bowser in a Node.js Express app to detect whether an incoming request is from a mobile device and redirect those users to a mobile-specific route.
Prompt 3
Using bowser's satisfies method, write a snippet that displays a warning banner if the visitor is using any version of Internet Explorer.
Prompt 4
How do I set up bowser with TypeScript imports and use it to log the browser name, version, and OS to the console?
Prompt 5
Using bowser, write a React hook called useBrowserInfo that returns the parsed browser name, OS name, and platform type so I can use it anywhere in my app.
Open on GitHub → Explain another repo

← bowser-js on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.