Skip to content

Commit e3d5f76

Browse files
committed
Backport - Improve browser detection: rename "Samsung Browser" to "Samsung Internet" (cherry picked from commit 5c10e2b)
https://developer.samsung.com/internet/user-agent-string-format.html
1 parent 02af42f commit e3d5f76

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

src/ua-parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@
273273
], [VERSION, [NAME, FIREFOX]], [
274274
/\bqihu|(qi?ho?o?|360)browser/i // 360
275275
], [[NAME, '360 ' + BROWSER]], [
276-
/(oculus|samsung|sailfish|huawei|vivo)browser\/([\w\.]+)/i
277-
], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/HuaweiBrowser/VivoBrowser
276+
/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i
277+
], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser
278+
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
279+
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
278280
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
279281
], [[NAME, /_/g, ' '], VERSION], [
280282
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer

test/browser-test.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
}
@@ -1169,11 +1169,41 @@
11691169
}
11701170
},
11711171
{
1172-
"desc" : "Samsung Browser",
1172+
"desc" : "Samsung Internet for Android",
11731173
"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",
11741174
"expect" :
11751175
{
1176-
"name" : "Samsung Browser",
1176+
"name" : "Samsung Internet",
1177+
"version" : "4.0",
1178+
"major" : "4"
1179+
}
1180+
},
1181+
{
1182+
"desc" : "Samsung Internet for Tizen Mobile",
1183+
"ua" : "Mozilla/5.0 (Linux; Tizen 2.3; SAMSUNG SM-Z130H) AppleWebKit/537.3 (KHTML, like Gecko) SamsungBrowser/1.0 Mobile Safari/537.3",
1184+
"expect" :
1185+
{
1186+
"name" : "Samsung Internet",
1187+
"version" : "1.0",
1188+
"major" : "1"
1189+
}
1190+
},
1191+
{
1192+
"desc" : "Samsung Internet for Smart-TV",
1193+
"ua" : "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1",
1194+
"expect" :
1195+
{
1196+
"name" : "Samsung Internet",
1197+
"version" : "1.0",
1198+
"major" : "1"
1199+
}
1200+
},
1201+
{
1202+
"desc" : "Samsung Internet for Gear VR",
1203+
"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",
1204+
"expect" :
1205+
{
1206+
"name" : "Samsung Internet",
11771207
"version" : "4.0",
11781208
"major" : "4"
11791209
}

0 commit comments

Comments
 (0)