Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Xbox OS detection #479

Merged
merged 2 commits into from Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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