From e7bfc4e28d9680f6eadb54a39760517719846f99 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 28 May 2024 20:35:18 +0700 Subject: [PATCH] Backport - Fix #730 - Improve browser detection: DuckDuckGo (cherry picked from commit e87c794fd95628743f25027b58faed00dc8d0cdc) --- src/ua-parser.js | 2 ++ test/browser-test.json | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index e5ad577a8..fc1d633d2 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -243,6 +243,8 @@ /(heytap|ovi)browser\/([\d\.]+)/i, // Heytap/Ovi /(weibo)__([\d\.]+)/i // Weibo ], [NAME, VERSION], [ + /\bddg\/([\w\.]+)/i // DuckDuckGo + ], [VERSION, [NAME, 'DuckDuckGo']], [ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser ], [VERSION, [NAME, 'UC'+BROWSER]], [ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser diff --git a/test/browser-test.json b/test/browser-test.json index 29665b746..79f965f50 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -419,6 +419,16 @@ "major" : "1" } }, + { + "desc" : "DuckDuckGo", + "ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.1517.4.1 Ddg/17.4.1", + "expect" : + { + "name" : "DuckDuckGo", + "version" : "17.4.1", + "major" : "17" + } + }, { "desc" : "DuckDuckGo", "ua" : "Mozilla/5.0 (Linux; Android 8.1.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.131 Mobile DuckDuckGo/5 Safari/537.36",