Skip to content

Commit

Permalink
Add support of the new Blink-based MS Edge
Browse files Browse the repository at this point in the history
fixes #311
  • Loading branch information
lancedikson committed Apr 14, 2019
1 parent 5c47015 commit d596a43
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/parser-browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,22 @@ const browsersList = [
return browser;
},
},
{
test: [/\sedg\//i],
describe(ua) {
const browser = {
name: 'Microsoft Edge',
};

const version = Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, ua);

if (version) {
browser.version = version;
}

return browser;
},
},
{
test: [/edg([ea]|ios)/i],
describe(ua) {
Expand Down
11 changes: 11 additions & 0 deletions src/parser-engines.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ export default [
return parser.getBrowserName(true) === 'microsoft edge';
},
describe(ua) {
const isBlinkBased = /\sedg\//i.test(ua);

// return blink if it's blink-based one
if (isBlinkBased) {
return {
name: 'Blink',
};
}

// otherwise match the version and return EdgeHTML
const version = Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);

return {
name: 'EdgeHTML',
version,
Expand Down
28 changes: 28 additions & 0 deletions test/acceptance/useragentstrings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,34 @@
engine:
name: "EdgeHTML"
version: "12.0"
-
ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.48 Safari/537.36 Edg/74.1.96.24"
spec:
browser:
name: "Microsoft Edge"
version: "74.1.96.24"
os:
name: "Windows"
version: "NT 10.0"
versionName: "10"
platform:
type: "desktop"
engine:
name: "Blink"
-
ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3739.0 Safari/537.36 Edg/75.0.109.0"
spec:
browser:
name: "Microsoft Edge"
version: "75.0.109.0"
os:
name: "Windows"
version: "NT 10.0"
versionName: "10"
platform:
type: "desktop"
engine:
name: "Blink"
Firefox:
-
ua: "Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0"
Expand Down

0 comments on commit d596a43

Please sign in to comment.