bowser-js /bowser
a browser detector
★ 5,766⑂ 485👁 99⑃ 327● 312▤ 41
+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
#242Version 2 lacks some useful information17 comments · 2018-08-19#140Add WebView detection16 comments · 2016-05-09#339"Bowser.getParser is not a function" on v2.5.113 comments · 2019-07-17#329iPadOS Safari 13 is detected as Safari 13 on MacOS 10.1512 comments · 2019-06-11#259v2.0 big bundle size10 comments · 2018-10-12#554iPad identifies (when using Safari) as running macOS 10.15.7 Catalina on Apple desktop Platform 9 comments · 2024-07-01#302Improve documentation for 2.08 comments · 2019-03-07#572External Microphone Permissions Not Handled Properly7 comments · 2025-11-18
Discussions
#502Looking for active maintainers 👀0 comments · 2021-12-14#482Поддержка браузерами0 comments · 2021-06-17#460Welcome to bowser Discussions!2 comments · 2020-12-09
Latest release
v2.15.0 v2.15.0 2026-10-26Security - 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