ua-parser / uap-core

The regex file necessary to build language ports of Browserscope's user agent parser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add detection for Edge Chromium

devsmaster07 opened this issue · comments

Edge Chromium is currently showing up as Chrome. Would it be possible to add detection for it?

Me too.

This is information from the chronium based edge browser I tested.

  • OS: Windows 10 Pro
  • Edge Beta Version: 79.0.309.60 (Official Build) beta (64Bits)
  • UserAgent Header:

    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36 Edg/79.0.309.60

ex) using ua-parser:uap-java:1.4.3

final String ua_edge = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36 Edg/79.0.309.60";
final Parser parser = new Parser();

Client client = parser.parse(ua_edge);
clientInfo.userAgent // {"family": "Chrome", "major": "79", "minor": "0", "patch": "3945"}
clientInfo.os // {"family": "Windows", "major": "10", "minor": "", "patch": "", "patch_minor": ""}
clientInfo.device // {"family": "Other"}

※ Reference

User-Agent of Edge Dev: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4003.0 Safari/537.36 Edg/81.0.381.0
User-Agent of Edge Canary: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4016.0 Safari/537.36 Edg/81.0.387.0

@devsmaster07 ,

I noticed that the yaml file versions in master branch and uap-java:1.4.3 are different. As a master branch standard, it is supported for Edge for Desktop. However, it is not compatible with iOS and Android.

I solved this by adding: Of course, this may not be the right answer, or it may be inefficient.

# Android
- regex: '(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+) Mobile(?:[ /]|$).*[ +]EdgA'
  family_replacement: 'Mobile Edge'
# iOS
- regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+)|).*Mobile.*[ +]EdgiOS'
  family_replacement: 'Mobile Edge'

Add the above and run test to see that there is no problem.

any update?

PRs are welcome.

I handled some issues and sent a PR.