Search code examples
microsoft-edgeuser-agentblink

How can you tell new Blink based Edge apart from old EdgeHTML via its userAgent?


With the 2018 Microsoft Edge team announcement that Edge is changing browser engines to Blink, it is not obvious how to compensate for EdgeHTML specific bugs and weirdnesses by looking at User-Agent strings (for oddities you can't feature detect any better way). When this need arises, what reliably tells the two browser engines apart?


Solution

  • If your site is being targeted for UA string overrides, you can't: depending on what those overrides say, the user-agent will supposedly either pretend to be the old Edge, or a corresponding Chrome browser.

    Otherwise, the trick is to scan navigator.userAgent for the substring Edg/ (no trailing e before the slash), which is its default setting. The old Edge would have Edge/ there, instead. Example agent strings:

    • new Edge (default): Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3763.0 Safari/537.36 Edg/75.0.131.0
    • old Edge (white lie): Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763
    • Chrome (white lie): Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3763.0 Safari/537.36