Skip to main content

getEngine()

The rendering-engine counterpart to detect(). Returns one of the engines values, narrowed to the Engine union.

Signature(options?: DetectOptions) => Engine
Returns'blink' | 'gecko' | 'webkit' | 'trident' | 'presto' | 'edgehtml' | 'unknown'
SSR safe✅ Pass { userAgent } to pin

Why the engine, not the brand?

Rendering bugs live in the engine, not the badge on the icon. Two reasons this is the function you often actually want:

  1. iOS forces WebKit on everyone. Apple requires every browser on iOS/iPadOS to use WKWebView. Chrome-iOS, Firefox-iOS, and Edge-iOS all render with WebKit — they just paint a different UI on top. detect() honestly reports them as chrome / firefox / edge, but for a rendering workaround you want getEngine(), which reports webkit for all of them in one check.

  2. The whole Chromium family shares Blink. Chrome, Edge, Opera, Brave, Vivaldi, Arc — all Blink. If your fix is engine-level, getEngine() === engines.BLINK is one comparison instead of five.

import { getEngine, engines } from 'get-browser';

// One check covers Safari + Chrome-iOS + Firefox-iOS + Edge-iOS.
if (getEngine() === engines.WEBKIT) {
applyWebkitScrollFix();
}
Don't hand-roll browser → engine

A naive { chrome: 'blink', safari: 'webkit', … }[detect()] lookup is wrong on iOS — it maps Chrome-iOS to Blink when the page is really rendered by WebKit. getEngine() reads the platform from the UA and gets it right.

The engines enum

export const engines: {
readonly BLINK: 'blink';
readonly EDGEHTML: 'edgehtml';
readonly GECKO: 'gecko';
readonly PRESTO: 'presto';
readonly TRIDENT: 'trident';
readonly WEBKIT: 'webkit';
readonly UNKNOWN: 'unknown';
};
ValueEngineBrowsers
blinkBlink (Chromium)Chrome, Edge, Opera, Brave, Vivaldi, Arc, modern Android WebView
geckoGeckoFirefox on every platform except iOS
webkitWebKitSafari, every browser on iOS/iPadOS, pre-2014 Android Browser
tridentTridentInternet Explorer 6–11
prestoPrestoOpera 12 and earlier, Opera Mini
edgehtmlEdgeHTMLLegacy Microsoft Edge 12–18 (the Edge/ token)
unknownbots, brand-new engines, empty UA

Blink vs "Chromium": Blink is the engine; Chromium is the project it lives in. The canonical value is 'blink' — that's the actual rendering engine, and it's what ua-parser-js and bowser report too.

Detection order

Most-specific first:

  1. TridentTrident/ or MSIE.
  2. EdgeHTML — the legacy Edge/ token (checked before Blink, since those UAs also carry Chrome/).
  3. PrestoPresto/ or Opera Mini.
  4. WebKit (iOS) — any iPhone / iPad / iPod, or CriOS / FxiOS / EdgiOS / OPiOS. Every iOS browser is WebKit.
  5. Gecko — a real Gecko/<digits> build token or Firefox/ (Chromium's "like Gecko" is deliberately not matched).
  6. BlinkChrome/, Chromium/, Edg/, or OPR/.
  7. WebKit (Safari / legacy) — any remaining Safari/ / AppleWebKit — desktop Safari or the legacy Android Browser.
  8. 'unknown'.

Examples

import { getEngine, engines } from 'get-browser';

// iOS Safari (and therefore every iOS browser) needs the 100vh fix.
if (getEngine() === engines.WEBKIT) {
const setVh = () =>
document.documentElement.style.setProperty('--vh', `${innerHeight * 0.01}px`);
setVh();
addEventListener('resize', setVh, { passive: true });
}

Pairs with detect() and getOS()

Three orthogonal axes — who, what renders it, where it runs:

import { detect, getEngine, getOS } from 'get-browser';

// Chrome on an iPhone:
detect(); // → 'chrome' (the brand)
getEngine(); // → 'webkit' (what actually paints — WKWebView)
getOS(); // → 'ios' (the platform)

Caveats

  • Not a feature check. Knowing the engine is not the same as knowing a feature is supported. For "does this support :has()?" use CSS.supports() / @supports. getEngine() is for grouping known engine-level quirks and for analytics.
  • edgehtml / presto are effectively extinct but reported honestly when their UAs appear. Exhaustive switch statements should still handle them (or use a default).

See also