Skip to content

Commit

Permalink
Improve browser detection: rename "Samsung Browser" to "Samsung Inter…
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Oct 23, 2023
1 parent 46ff3df commit 5c10e2b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,10 @@
], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
/\bqihu|(qi?ho?o?|360)browser/i // 360
], [[NAME, '360' + SUFFIX_BROWSER]], [
/(oculus|samsung|sailfish|huawei|vivo)browser\/([\w\.]+)/i
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/HuaweiBrowser/VivoBrowser
/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION], [
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
Expand Down
36 changes: 33 additions & 3 deletions test/specs/browser-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"ua" : "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-G925F Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.0 Chrome/38.0.2125.102 Mobile Safari/537.36",
"expect" :
{
"name" : "Samsung Browser",
"name" : "Samsung Internet",
"version" : "3.0",
"major" : "3"
}
Expand Down Expand Up @@ -1189,11 +1189,41 @@
}
},
{
"desc" : "Samsung Browser",
"desc" : "Samsung Internet for Android",
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG-SM-G925A Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36",
"expect" :
{
"name" : "Samsung Browser",
"name" : "Samsung Internet",
"version" : "4.0",
"major" : "4"
}
},
{
"desc" : "Samsung Internet for Tizen Mobile",
"ua" : "Mozilla/5.0 (Linux; Tizen 2.3; SAMSUNG SM-Z130H) AppleWebKit/537.3 (KHTML, like Gecko) SamsungBrowser/1.0 Mobile Safari/537.3",
"expect" :
{
"name" : "Samsung Internet",
"version" : "1.0",
"major" : "1"
}
},
{
"desc" : "Samsung Internet for Smart-TV",
"ua" : "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1",
"expect" :
{
"name" : "Samsung Internet",
"version" : "1.0",
"major" : "1"
}
},
{
"desc" : "Samsung Internet for Gear VR",
"ua" : "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-G925K Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile VR Safari/537.36",
"expect" :
{
"name" : "Samsung Internet",
"version" : "4.0",
"major" : "4"
}
Expand Down

0 comments on commit 5c10e2b

Please sign in to comment.