First-class support for every framework you ship with
The library is platform-neutral — same imports, same call shape — and ships dedicated recipes for the runtimes and frameworks you actually use.
This card is reading your actual user-agent
Pick a sample UA from the dropdown, paste your own, or leave both empty to detect against your real navigator.userAgent. The code path is exactly the one your app would run.
detect()returns one ofbrowsers.*- Predicates like
isSafari()return a strictboolean - Pass an explicit UA for SSR / unit-test scenarios
- The LIVE dot says where the UA is coming from
Why get-browser?
User-agent sniffing is a pile of caveats, but sometimes you really do need it — to gate a polyfill, render a download badge, or tag analytics. get-browser is the small, opinionated utility for those cases.
Tiny by design
~1.5 kB min+gzip, zero runtime dependencies, fully tree-shakeable. Importing only isChrome ships nothing else.
Strict TypeScript
detect() returns the Browser union — never plain string. Exhaustive switch statements compile.
SSR-safe
Every detector takes an optional { userAgent, vendor }. No window access at import time — runs in Node, Next.js, Remix, Astro, and tests.
Covers what ships
Chrome, Edge (legacy + Chromium), Firefox, Safari (macOS / iOS / iPadOS), Opera (Presto + OPR), IE 6–11, Android WebView — including CriOS, FxiOS,EdgiOS.
Dual ESM + CJS
import and require both work. UMD/IIFE bundle (GetBrowser global) ships for <script> tags.
Honest scope
Answers who, not what. For capability gating, use @supports or matchMedia. We only do the part those can't.
USE CASES
The narrow set of times you actually need UA sniffing
Most of the time, feature detection is the right answer. These are the cases where it isn't.
Browser-specific workarounds
Patch a Safari scroll-anchor bug. Polyfill `inert` on Firefox iOS. Tell IE 11 to please upgrade.
Read more →Analytics tagging
Add browser family + engine + form factor to every event. Exhaustive switch means no silent drift.
Read more →Lazy polyfill loading
Decide at request time whether to ship a 30 kB polyfill. The check is ~400 bytes once tree-shaken.
Read more →Server-side rendering
Read the UA from the request, render the right markup. Works in Next.js, Remix, Astro, Workers, Deno.
Read more →Download / install badges
"Install for Chrome" → store. "Install for Firefox" → store. Type-safe lookup, exhaustive at compile.
Read more →Test fixtures
Pass an explicit UA — pure, deterministic, no DOM mock. Write tests that pin browser-specific paths.
Read more →How it stacks up against the alternatives
get-browser trades version-parsing and device-info for a fraction of the footprint. If your job is "tell me which browser, then get out of my way," this is your library.
get-browserthis librarydetect-browserbowserua-parser-js
Sizes are min+gzip of the full library bundle. get-browser also tree-shakes down to ~400 bytes when you import a single predicate.
READY?
Install in one line. Ship in the next.
get-browser is what you reach for when you just want a single, lowercase, typed answer to which browser is this?
$ pnpm add get-browser