[Solved] I am trying to make a function that determines the browser but the new Microsoft Edge is not being detected


It looks like the full user agent string for desktop is:

Mozilla/5.0 (Windows NT 10.0; <64-bit tags>) AppleWebKit/<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Safari/<WebKit Rev> Edge/<EdgeHTML Rev>.<Windows Build>

This is according to Microsoft’s documentation: https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx

So, I suppose you just have to search for the substring ‘Edge/’, and you’ll have your answer. I didn’t test this, but it seems reasonable to me. Something like this:

var isEdge = window.navigator.userAgent.indexOf('Edge/') ? true : false;

Hope this helps.

solved I am trying to make a function that determines the browser but the new Microsoft Edge is not being detected