- Get more done with the new Google Chrome. A more simple, secure, and faster web browser than ever, with Google's smarts built-in.
- Depending on the OS, we ask him to install different applications. Since on iPadOS User Agent in Safari is same as on MacOS Catalina, what is recommened way to distinguish OS on server side? IPadOS: Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 1015) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15.
A browser's user agent string (UA) helps identify which browser is being used, what version, and on which operating system. When feature detection APIs are not available, use the UA to customize behavior or content to specific browser versions.
Like all other browsers,Chrome for Android sends this information in the User-Agent
HTTP header every time it makes a request to any site.It's also available in the client through JavaScript using thenavigator.userAgent
call.
Estimates vary but perhaps a third of Mac users choose to use the Chrome browser on their Apple system for some reason. If that's you, you'll benefit from the following tips.
Chrome for Android
Chrome for Androidreports its UA in the followingformats, depending on whether the device is a phone or a tablet.
Phone UA:
Tablet UA:
Here's an example of the Chrome user agent string on a Galaxy Nexus:
If you are parsing user agent strings using regular expressions, thefollowing can be used to check against Chrome on Android phones and tablets:
- Phone pattern:
'Android' + 'Chrome/[.0-9]* Mobile'
- Tablet pattern:
'Android' + 'Chrome/[.0-9]* (?!Mobile)'
Chrome for iOS
The UA in Chrome for iOS is the same as the Mobile Safariuser agent, with CriOS/
instead ofVersion/
.
Here's an example of the Chrome UA on iPhone:
For comparison, the Mobile Safari UA:
Up to Chrome 84, when the Request Desktop Site feature is enabled, theDesktop Safari UA is sent:Starting from Chrome 85, when the Request Desktop Site feature is enabled, theUA is the same as the Desktop Safari UA withCriOS/
being added:WebView on Android
The Android 4.4 (KitKat) Chromium-based WebView adds Chrome/_version_ to the user agent string.
Old WebView UA:
WebView UA in KitKat to Lollipop
If you're attempting to differentiate between the WebView and Chrome for Android,you should look for the presence of the Version/_X.X_ string in the WebViewuser-agent string. Don't rely on the specific Chrome version number(for example, 30.0.0.0) as the version numbers changes with each release.
WebView UA in Lollipop and Above
In the newer versions of WebView,you can differentiate the WebView by looking for the wv field as highlighted below.
This is more as a note to myself. Out of the box ADFS does not have WIA enabled for most browsers. You need to add the UserAgent strings of browsers you wish to enable WIA for. Here is the cmdlet with the list of agents I currently use: Eos for mac.
Set-AdfsProperties-WIASupportedUserAgents@('MSIE 6.0','MSIE 7.0; Windows NT','MSIE 8.0','MSIE 9.0','MSIE 10.0; Windows NT 6','Windows NT 6.3; Trident/7.0','Windows NT 6.3; Win64; x64; Trident/7.0','Windows NT 6.3; WOW64; Trident/7.0','Windows NT 6.2; Trident/7.0','Windows NT 6.2; Win64; x64; Trident/7.0','Windows NT 6.2; WOW64; Trident/7.0','Windows NT 6.1; Trident/7.0','Windows NT 6.1; Win64; x64; Trident/7.0','Windows NT 6.1; WOW64; Trident/7.0','MSIPC','Windows Rights Management Client','Mozilla/5.0','Edge/12','Chrome','Vivaldi') |
This is based on this & this Microsoft Docs plus some other blog posts I read over the years. I will keep updating this blog post with any updates.
It might be better to replace 'Chrome' above with 'Windowss*NT.*Chrome'. I found this in the comments of this article. Useful so it only targets Chrome on Windows and not iOS/ Android.
Here's the User Agent Strings from Safari on my iPhone, Mac Book, and Vivaldi on Windows.
User Agent Switcher For Chrome
- Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15
- Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Vivaldi/2.1.1337.36
Matching on 'Windowss*NT.*Chrome' (which I think is regex and so should translate to the string Windows followed by zero or more spaces, followed by NT, followed by zero or more characters, followed by Chrome) will thus only pick the last User Agent String.
Some more things to be done for WIA to work. You must add your ADFS site to the Local Intranet zone of IE. Best to use Group Policy Preferences for this, pushing out a registry key. Under the HKCU hive you can push out a key 'SoftwareMicrosoftWindowsCurrentVersionInternet SettingsZoneMapDomainsadfs.fqdn
' (or replace adfs with a * if you want *.fqdn to be matched), with a value of https
and data of DWORD 00000001 in hex. Chrome, and Chromium based browsers (such as Vivaldi, Edge, etc.) will use this list so WIA will work for them automatically.
This link from the Chromium page also mentions the SPN issue I encountered previously. The SPN generated will use the CNAME name if that exists, so better to use an A record with an IP address.
When a server or proxy presents Chrome with a Negotiate challenge, Chrome tries to generate a Kerberos SPN (Service Principal Name) based on the host and port of the original URI. Unfortunately, the server does not indicate what the SPN should be as part of the authentication challenge, so Chrome (and other browsers) have to guess what it should be based on standard conventions.
Chrome for Androidreports its UA in the followingformats, depending on whether the device is a phone or a tablet.
Phone UA:
Tablet UA:
Here's an example of the Chrome user agent string on a Galaxy Nexus:
If you are parsing user agent strings using regular expressions, thefollowing can be used to check against Chrome on Android phones and tablets:
- Phone pattern:
'Android' + 'Chrome/[.0-9]* Mobile'
- Tablet pattern:
'Android' + 'Chrome/[.0-9]* (?!Mobile)'
Chrome for iOS
The UA in Chrome for iOS is the same as the Mobile Safariuser agent, with CriOS/
instead ofVersion/
.
Here's an example of the Chrome UA on iPhone:
For comparison, the Mobile Safari UA:
Up to Chrome 84, when the Request Desktop Site feature is enabled, theDesktop Safari UA is sent:Starting from Chrome 85, when the Request Desktop Site feature is enabled, theUA is the same as the Desktop Safari UA withCriOS/
being added:WebView on Android
The Android 4.4 (KitKat) Chromium-based WebView adds Chrome/_version_ to the user agent string.
Old WebView UA:
WebView UA in KitKat to Lollipop
If you're attempting to differentiate between the WebView and Chrome for Android,you should look for the presence of the Version/_X.X_ string in the WebViewuser-agent string. Don't rely on the specific Chrome version number(for example, 30.0.0.0) as the version numbers changes with each release.
WebView UA in Lollipop and Above
In the newer versions of WebView,you can differentiate the WebView by looking for the wv field as highlighted below.
This is more as a note to myself. Out of the box ADFS does not have WIA enabled for most browsers. You need to add the UserAgent strings of browsers you wish to enable WIA for. Here is the cmdlet with the list of agents I currently use: Eos for mac.
Set-AdfsProperties-WIASupportedUserAgents@('MSIE 6.0','MSIE 7.0; Windows NT','MSIE 8.0','MSIE 9.0','MSIE 10.0; Windows NT 6','Windows NT 6.3; Trident/7.0','Windows NT 6.3; Win64; x64; Trident/7.0','Windows NT 6.3; WOW64; Trident/7.0','Windows NT 6.2; Trident/7.0','Windows NT 6.2; Win64; x64; Trident/7.0','Windows NT 6.2; WOW64; Trident/7.0','Windows NT 6.1; Trident/7.0','Windows NT 6.1; Win64; x64; Trident/7.0','Windows NT 6.1; WOW64; Trident/7.0','MSIPC','Windows Rights Management Client','Mozilla/5.0','Edge/12','Chrome','Vivaldi') |
This is based on this & this Microsoft Docs plus some other blog posts I read over the years. I will keep updating this blog post with any updates.
It might be better to replace 'Chrome' above with 'Windowss*NT.*Chrome'. I found this in the comments of this article. Useful so it only targets Chrome on Windows and not iOS/ Android.
Here's the User Agent Strings from Safari on my iPhone, Mac Book, and Vivaldi on Windows.
User Agent Switcher For Chrome
- Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15
- Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Vivaldi/2.1.1337.36
Matching on 'Windowss*NT.*Chrome' (which I think is regex and so should translate to the string Windows followed by zero or more spaces, followed by NT, followed by zero or more characters, followed by Chrome) will thus only pick the last User Agent String.
Some more things to be done for WIA to work. You must add your ADFS site to the Local Intranet zone of IE. Best to use Group Policy Preferences for this, pushing out a registry key. Under the HKCU hive you can push out a key 'SoftwareMicrosoftWindowsCurrentVersionInternet SettingsZoneMapDomainsadfs.fqdn
' (or replace adfs with a * if you want *.fqdn to be matched), with a value of https
and data of DWORD 00000001 in hex. Chrome, and Chromium based browsers (such as Vivaldi, Edge, etc.) will use this list so WIA will work for them automatically.
This link from the Chromium page also mentions the SPN issue I encountered previously. The SPN generated will use the CNAME name if that exists, so better to use an A record with an IP address.
When a server or proxy presents Chrome with a Negotiate challenge, Chrome tries to generate a Kerberos SPN (Service Principal Name) based on the host and port of the original URI. Unfortunately, the server does not indicate what the SPN should be as part of the authentication challenge, so Chrome (and other browsers) have to guess what it should be based on standard conventions.
User-agent Switcher For Chrome Mac
The default SPN is: HTTP/, where is the canonical DNS name of the server. This mirrors the SPN generation logic of IE and Firefox.