How to identify user is iOS when 'Request Desktop Website' of Safari is enabled on iOS13.

Safari on iOS13 has a setting "Request Desktop Website" that changes value of 'userAgent' same with macOS 10.15.

*The default value of this setting is on on iPadOS and off on iOS.

The 'navigator' object properties when 'Request Desktop Website' is disabled.

This is value on iPadOS. The 'userAgent' value include 'iPad'.

plugins : "[object PluginArray]"
mimeTypes : "[object MimeTypeArray]"
cookieEnabled : "true"
standalone : "false"
geolocation : "[object Geolocation]"
mediaCapabilities : "[object MediaCapabilities]"
webdriver : "false"
maxTouchPoints : "5"
appCodeName : "Mozilla"
appName : "Netscape"
appVersion : "5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/604.1"
platform : "iPad"
product : "Gecko"
productSub : "20030107"
userAgent : "Mozilla/5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/604.1"
vendor : "Apple Computer, Inc."
vendorSub : ""
language : "en-US"
languages : "en-US"
onLine : "true"

The 'navigator' object properties when 'Request Desktop Website' is enabled.

This is value on iPadOS. The 'userAgent' value become same with macOS 10.15 so we cannot identify this user is iOS or macOS.

plugins : "[object PluginArray]"
mimeTypes : "[object MimeTypeArray]"
cookieEnabled : "true"
standalone : "false"
geolocation : "[object Geolocation]"
mediaCapabilities : "[object MediaCapabilities]"
webdriver : "false"
maxTouchPoints : "5"
appCodeName : "Mozilla"
appName : "Netscape"
appVersion : "5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15"
platform : "MacIntel"
product : "Gecko"
productSub : "20030107"
userAgent : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15"
vendor : "Apple Computer, Inc."
vendorSub : ""
language : "en-US"
languages : "en-US"
onLine : "true"

The 'navigator' object properties of macOS 10.15

plugins : "[object PluginArray]"
mimeTypes : "[object MimeTypeArray]"
cookieEnabled : "true"
geolocation : "[object Geolocation]"
mediaCapabilities : "[object MediaCapabilities]"
webdriver : "false"
maxTouchPoints : "0"
appCodeName : "Mozilla"
appName : "Netscape"
appVersion : "5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15"
platform : "MacIntel"
product : "Gecko"
productSub : "20030107"
userAgent : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15"
vendor : "Apple Computer, Inc."
vendorSub : ""
language : "ja-JP"
languages : "ja-JP"
onLine : "true"

How to identify user is iOS

We can use 'maxTouchPoints' value for identify the user is iOS or macOS. When the value greater than 0, this user use iOS.

//  macOS
if (navigator.platform.indexOf('Mac') != -1) {
  //  iOS13 or above and 'Request Desktop Website' is enabled
  if(navigator.maxTouchPoints != undefined && navigator.maxTouchPoints > 0) {
    return "iOS";
  }
  return "Mac";
}

*It may 'maxTouchPoint' is undefined on other browsers.

*Theres is no macOS products that have touch screen function. So the value 'maxTouchPoint' is greater than 0, it's cannot be macOS.

*WKWebView has not affected by this setting that means 'userAgent' value is not changed. So third party browsers like Chrome has not affected.