isEdge()
truewhen the current environment is Microsoft Edge — both flavours.
| Signature | (options?: DetectOptions) => boolean |
| Matches | Edge/, Edg/, EdgA/, EdgiOS/ |
| Wins over | isChrome() for Chromium-Edge UAs |
Matches
- Legacy EdgeHTML (2015–2019) — UA token
Edge/. - Chromium-Edge (2020+) — UA token
Edg/,EdgA/(Android), orEdgiOS/(iOS).
Example
import { isEdge } from 'get-browser';
if (isEdge()) {
// Edge-specific code path
}
Why it precedes isChrome() in detect()
Chromium-Edge advertises both Chrome/ and Edg/. Without ordering, both predicates would return true and detect() would have to make a tie-breaker call. Running isEdge first guarantees Edge wins.
import { detect, isChrome, isEdge } from 'get-browser';
const ua = 'Mozilla/5.0 (Windows NT 10.0) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0';
detect({ userAgent: ua }); // → 'edge'
isEdge({ userAgent: ua }); // → true
isChrome({ userAgent: ua }); // → false (excluded by the Edg/ token)
See also
isChrome(),isOpera()— sibling Chromium browsers.detect()— the most-specific-first walk.