Skip to content

Commit 22da8fe

Browse files
vianaswenejb
andauthored
Update user agent info capabilities (#45632)
* Add user_agent optional param to static methods * Pass useragent to static methods Pass down the user agent in the methods get_browser, get_platform and get_desktop_platform. Another step in the direction of being able to use this class to parse user agent strings and not just the value set on $_SERVER['HTTP_USER_AGENT'] * Use useragent in is_tablet method * Add detection for 6 popular browsers We can now detect 6 additional popular browsers that were previously classified as "other": - Samsung Internet (default on Samsung devices) - UC Browser (popular in Asia) - Yandex Browser (popular in Russia) - Vivaldi (power users) - MIUI Browser (Xiaomi devices) - Amazon Silk (Kindle/Fire devices) Updated the detection order to check for Chromium-based browsers BEFORE checking for Chrome itself. This is critical because Samsung, Yandex, Vivaldi, UC, MIUI, and Silk all include "Chrome" in their user agent strings. Updated is_edge_browser() to detect both: - Legacy Edge: "Edge/" - Modern Chromium-based Edge: "Edg/" * Update tests for the new browsers detected * changelog * Explicitly test for bacwkard compatibility Added tests to make sure we fall back to $_SERVER['HTTP_USER_AGENT'] when $user_agent is not passed. * Add a new private maybe_get_user_agent_from_server method This is done so that we don't repeat outself so much --------- Co-authored-by: Enej Bajgoric <[email protected]>
1 parent 065e193 commit 22da8fe

File tree

4 files changed

+894
-205
lines changed

4 files changed

+894
-205
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: changed
3+
4+
Improved user agent string parsing functionality and added browser detection for six more browsers (Samsung Internet, UC, Yandex, Vivaldi, MIUI, Amazon Silk)

0 commit comments

Comments
 (0)