GWT and UserAgent

326 views
Skip to first unread message

David Nouls

unread,
Feb 18, 2022, 12:00:24 PM2/18/22
to GWT Users
Hello I read that FireFox and Chrome are deprecating the useragent string.
Is GWT depending on this and will it be impacted ?

Thomas Broyer

unread,
Feb 20, 2022, 6:02:37 AM2/20/22
to GWT Users
On Friday, February 18, 2022 at 6:00:24 PM UTC+1 David Nouls wrote:
Hello I read that FireFox and Chrome are deprecating the useragent string.

Not sure where you read that and what it would really mean, particularly wrt backwards compatibility: browser vendors (and spec writers) try very hard not to "break the web" (e.g. its Array.prototype.includes rather than Array.prototype.contains because many old-ish libraries monkey-patched the Array prototype with a 'contains' method) so it's very unlikely that they remove the navigator.useragent or change it in a breaking way.
What has been envisioned is to actually freeze the version in the UA string in case using a 3-digit version breaks too many websites, with Chrome relegating the major version into its "minor".
 
Is GWT depending on this and will it be impacted ?

GWT does depend on the UA string, but doesn't care about the browser version, except in very few cases.
Here's the main UA-sniffing code that helps select permutations, it doesn't use the version (uses documentMode in Internet Explorer, which has since been removed and won't be in 2.10): https://github.com/gwtproject/gwt/blob/2.9.0/user/src/com/google/gwt/useragent/rebind/UserAgentPropertyGenerator.java
And here are a few cases that care about the version:
All other uses of navigator.useragent seem to only care about some tokens like "safari", "chrome", "webkit", "msie", or "gecko".

Jens

unread,
Feb 24, 2022, 5:56:58 AM2/24/22
to GWT Users
Chrome / Safari / FireFox are all freeze their user agent string so you can not know operating system version, device type and browser build number (not the major version!) anymore. This is done to make fingerprinting more difficult.

Here is some Chrome documentation:
If you need to access such high entropy data you need to use a new API. GWT itself should not be affected by these changes since you can still sniff if it is Chrome / Safari / Firefox and which major version it is.

-- J.
Reply all
Reply to author
Forward
0 new messages