Skip to content

Commit

Permalink
Merge pull request #479 from joeyparrish/develop
Browse files Browse the repository at this point in the history
fix: Xbox OS detection
  • Loading branch information
faisalman committed Feb 10, 2021
2 parents 45bf76a + 9d154cc commit 5b83893
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/ua-parser.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ua-parser.pack.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/ua-parser.js
Expand Up @@ -719,6 +719,9 @@

os : [[

// Xbox, consider this before other Windows-based devices
/(xbox);\s+xbox\s([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)

// Windows based
/microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes)
], [NAME, VERSION], [
Expand Down
36 changes: 36 additions & 0 deletions test/os-test.json
Expand Up @@ -287,6 +287,42 @@
"version" : "4"
}
},
{
"desc" : "Xbox 360",
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox 360) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
"expect" :
{
"name" : "Xbox",
"version" : "360"
}
},
{
"desc" : "Xbox One",
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox One; WebView/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041",
"expect" :
{
"name" : "Xbox",
"version" : "One"
}
},
{
"desc" : "Xbox X",
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36 Edge/20.02",
"expect" :
{
"name" : "Xbox",
"version" : "X"
}
},
{
"desc" : "Xbox Series X",
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox Series X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36 Edge/20.02 ",
"expect" :
{
"name" : "Xbox",
"version" : "Series X"
}
},
{
"desc" : "Mint",
"ua" : "",
Expand Down

0 comments on commit 5b83893

Please sign in to comment.