Search code examples
javascriptmicrosoft-edgeuser-agentnavigatorarcgis-js-api

Detecting Edge Legacy browser, not Edge Chromium


ArcGIS is depreciating use of IE11 and Legacy Edge browsers with current and future versions of their JavaScript API.

https://www.esri.com/arcgis-blog/products/arcgis/announcements/so-long-internet-explorer-11/

I'd like to know how to target legacy version of edge and alert users things may not work properly. Using:

navigator.userAgent.indexOf("Edge/") > -1 || navigator.userAgent.indexOf("Edg/") > -1;

does not work since Chromium Edge is still edge in the user agent. Is there anything else I could use that would allow me to differentiate between the two?


Solution

  • It's Edg in Edge Chromium user agent and Edge in Edge Legacy user agent. So you only need to use Edge to detect Edge Legacy:

    navigator.userAgent.indexOf("Edge/") > -1