arasatasaygin/is.js

is.edge() returns false in edge (tested on windows and mac os)

Opened this issue · 3 comments

This is because the regex is:
var match = userAgent.match(/edge\/(\d+)/);
Whereas the user agent chosen by microsoft is edg. (see here https://docs.microsoft.com/en-us/microsoft-edge/web-platform/user-agent-string).

My user agent on macos is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 Edg/83.0.478.56

It is the same on windows too.

I propose changing the regex to: var match = userAgent.match(/edg\/(\d+)/);

This is because the newer versions of Edge are essentially Chromium now, and Microsoft changed the user agent to Edg to avoid inconsistencies with detecting the Spartan and Chromium user agents.

Given the reason why #214 was closed, I would wager that it would be acceptable that is.edge() returns false and is.chrome() returns true. I use is.ie() || is.edge() to detect cases where a user is using either IE or Edge Spartan, so if Edge Chromium were to be "fixed" I would personally prefer another function like is.edgeChromium() to detect newer versions of Edge instead.

is.edgeChromium()

I think this is a good proposal.

Any update on this? Would love to see edgeChromium.