Skip to content

Commit 5c10e2b

Browse files
committed
Improve browser detection: rename "Samsung Browser" to "Samsung Internet" https://developer.samsung.com/internet/user-agent-string-format.html
1 parent 46ff3df commit 5c10e2b

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

src/main/ua-parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,10 @@
347347
], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
348348
/\bqihu|(qi?ho?o?|360)browser/i // 360
349349
], [[NAME, '360' + SUFFIX_BROWSER]], [
350-
/(oculus|samsung|sailfish|huawei|vivo)browser\/([\w\.]+)/i
351-
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/HuaweiBrowser/VivoBrowser
350+
/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i
351+
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser
352+
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
353+
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
352354
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
353355
], [[NAME, /_/g, ' '], VERSION], [
354356
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer

test/specs/browser-all.json

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"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",
8585
"expect" :
8686
{
87-
"name" : "Samsung Browser",
87+
"name" : "Samsung Internet",
8888
"version" : "3.0",
8989
"major" : "3"
9090
}
@@ -1189,11 +1189,41 @@
11891189
}
11901190
},
11911191
{
1192-
"desc" : "Samsung Browser",
1192+
"desc" : "Samsung Internet for Android",
11931193
"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",
11941194
"expect" :
11951195
{
1196-
"name" : "Samsung Browser",
1196+
"name" : "Samsung Internet",
1197+
"version" : "4.0",
1198+
"major" : "4"
1199+
}
1200+
},
1201+
{
1202+
"desc" : "Samsung Internet for Tizen Mobile",
1203+
"ua" : "Mozilla/5.0 (Linux; Tizen 2.3; SAMSUNG SM-Z130H) AppleWebKit/537.3 (KHTML, like Gecko) SamsungBrowser/1.0 Mobile Safari/537.3",
1204+
"expect" :
1205+
{
1206+
"name" : "Samsung Internet",
1207+
"version" : "1.0",
1208+
"major" : "1"
1209+
}
1210+
},
1211+
{
1212+
"desc" : "Samsung Internet for Smart-TV",
1213+
"ua" : "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1",
1214+
"expect" :
1215+
{
1216+
"name" : "Samsung Internet",
1217+
"version" : "1.0",
1218+
"major" : "1"
1219+
}
1220+
},
1221+
{
1222+
"desc" : "Samsung Internet for Gear VR",
1223+
"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",
1224+
"expect" :
1225+
{
1226+
"name" : "Samsung Internet",
11971227
"version" : "4.0",
11981228
"major" : "4"
11991229
}

0 commit comments

Comments
 (0)