bowser-js /bowser

a browser detector

★ 5,766⑂ 485👁 99⑃ 327● 312▤ 41
JavaScriptNOASSERTIONCreated 2011-04-27bowser-js.github.io/bowser/
下载:v2.15.0v2.15.0 ↓2.15.02026-10-26
+0
日增长
5,766
stars
485
forks
99
watchers
327
prs
312
issues
41
releases

README

Bowser
A small, fast and rich-API browser/platform/engine detector for both browser and node.
- Small. Use plain ES5-version which is ~4.8kB gzipped.
- Optimized. Use only those parsers you need — it doesn't do useless work.
- Multi-platform. It's browser- and node-ready, so you can use it in any environment.

Don't hesitate to support the project on Github or OpenCollective if you like it ❤️ Also, contributors are always welcome!

 !Downloads

 Contents
- Overview
- Use cases
  - Browser props detection
  - Using User-Agent Client Hints
  - Filtering browsers

 Overview

The library is made to help to detect what browser your user has and gives you a convenient API to filter the users somehow depending on their browsers. Check it out on this page: https://bowser-js.github.io/bowser-online/.

 ⚠️ Version 2.0 breaking changes ⚠️

Version 2.0 has drastically changed the API. All available methods are on the docs page.

_For legacy code, check out the 1.x branch and install it through npm install [email protected]._

 Use cases

First of all, require the library. Bowser is a dual package: require resolves
to a UMD build (which also works for AMD and as a plain  tag), and
import resolves to a real ES module.

javascript
const Bowser = require("bowser"); // CommonJS

import  as Bowser from "bowser"; // TypeScript

import Bowser from "bowser"; // ES6 (and TypeScript with --esModuleInterop enabled)


The ES module build also exposes parse, getParser, BROWSER_MAP,
ENGINE_MAP, OS_MAP and PLATFORMS_MAP as named exports. Detection needs
every parser either way, so named imports are a matter of style, not bundle
size — but an import that ends up unused is dropped entirely:

javascript
import { getParser, parse } from "bowser";

const browser = getParser(window.navigator.userAgent);


Loaded from a CDN or a  tag, Bowser attaches itself to the global as
bowser (lowercase):

html


  console.log(bowser.parse(window.navigator.userAgent));



By default, the exported version is the ES5 transpiled version, which do not include any polyfills.

In case you don't use your own polyfills you may need to have pre-built bundle with all needed polyfills.
So, for you it's suitable to require bowser like this: require('bowser/bundled').
As the result, you get a ES5 version of bowser with core-js polyfills bundled together.

You may need to use the source files, so they will be available in the package as well.

 Browser props detection

Often we need to pick users' browser properties such as the name, the version, the rendering engine and so on. Here is an example how to do it with Bowser:

javascript
const browser = Bowser.getParser(window.navigator.userAgent);

console.log(The current browser name is "${browser.getBrowserName()}");
// The current browser name is "Internet Explorer"


 Using User-Agent Client Hints

Modern browsers support User-Agent Client Hints, which provide a more privacy-friendly and structured way to access browser information. Bowser can use Client Hints

Top issues

Discussions

Latest release

v2.15.0 v2.15.0 2026-10-26
Security

- fix: polynomial ReDoS in the Firefox-on-iPad user-agent rule (GHSA-f9xq-72p3-q9fv). A crafted User-Agent could block the Node.js event loop for seconds per Bowser.parse() call. Thanks to @0xma1ware for the report.
- fix: four more polynomial ReDoS patterns (Linespider, SlackBot and the generic fallback rule), found by CodeQL (630).

 Worth knowing before upgrading

- New detections change reported browser names. HeyTap, Vivo and Ladybird users are now reported under their own names instead of Chrome, and Motorola Edge phones are no longer reported as Microsoft Edge. Dashboar

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON