IOS 13 and IPad Browsers

Hey all,

With the advent of IOS 13, iPads are now rendering websites the same as desktop. This is causing me some headache because something like right click controls that are available on a desktop are not easily available on an iPad. Previously, the session would report the platform as an iPad and I could load a unique page for the iPad. I can’t do that any more. The session is reporting the platform as Macintosh. I can’t find anything that ties it to an iPad.

How can I detect that the browser is from an iPad? Is there some other way?

Thanks,

Jon

This is what I wrote to let my Web App ask what type it was and return the result as plain English. Maybe Session.Browser and WebSession.BrowserType.XXXXXX will give you what you need?

[code]Protected Function getBrowserInfo(Type As String) as String
Select Case Type
Case “Browser”
Select Case Session.Browser
Case WebSession.BrowserType.Android
Return “Android”
Case WebSession.BrowserType.Blackberry
Return “Blackberry”
Case WebSession.BrowserType.Chrome
Return “Chrome”
Case WebSession.BrowserType.ChromeOS
Return “ChromeOS”
Case WebSession.BrowserType.Firefox
Return “Firefox”
Case WebSession.BrowserType.InternetExplorer
Return “Internet Explorer”
Case WebSession.BrowserType.Opera
Return “Opera”
Case WebSession.BrowserType.OperaMini
Return “Opera Mini”
Case WebSession.BrowserType.Safari
Return “Safari”
Case WebSession.BrowserType.SafariMobile
Return “Safari Mobile”
Case WebSession.BrowserType.Unknown
Return “Unknown”
Case else
Return “Unknown”
End Select

case “SmallScreen” 'check if on a small screen device device
Select Case Session.Browser
Case WebSession.BrowserType.Android, WebSession.BrowserType.Blackberry, WebSession.BrowserType.OperaMini, WebSession.BrowserType.SafariMobile
Return “True”
end select
Select Case Session.Platform
Case WebSession.PlatformType.AndroidPhone, WebSession.PlatformType.Blackberry, WebSession.PlatformType.iPhone, WebSession.PlatformType.iPodTouch
Return “True”
case else
Return “”
end select

case “Mobile” 'check if on a mobile device
Select Case Session.Browser
Case WebSession.BrowserType.Android, WebSession.BrowserType.Blackberry, WebSession.BrowserType.OperaMini, WebSession.BrowserType.SafariMobile
Return “True”
end select
Select Case Session.Platform
Case WebSession.PlatformType.AndroidPhone, WebSession.PlatformType.AndroidTablet, WebSession.PlatformType.Blackberry, WebSession.PlatformType.iPad, WebSession.PlatformType.iPhone, WebSession.PlatformType.iPodTouch
Return “True”
case else
Return “”
end select

Case “Platform”
Select Case Session.Platform
Case WebSession.PlatformType.AndroidPhone
Return “AndroidPhone”
Case WebSession.PlatformType.AndroidTablet
Return “AndroidTablet”
Case WebSession.PlatformType.Blackberry
Return “Blackberry”
Case WebSession.PlatformType.iPad
Return “iPad”
Case WebSession.PlatformType.iPhone
Return “iPhone”
Case WebSession.PlatformType.iPodTouch
Return “iPodTouch”
Case WebSession.PlatformType.Linux
Return “Linux”
Case WebSession.PlatformType.Macintosh
Return “Macintosh”
Case WebSession.PlatformType.PS3
Return “PS3”
Case WebSession.PlatformType.Unknown
Return “Unknown”
Case WebSession.PlatformType.WebOS
Return “WebOS”
Case WebSession.PlatformType.Wii
Return “Wii”
Case WebSession.PlatformType.Windows
Return “Windows”
Case else
Return “Unknown”
End Select

case “RenderingEngine”
Select Case Session.RenderingEngine
Case WebSession.EngineType.Gecko
Return “Gecko”
Case WebSession.EngineType.Presto
Return “Presto”
Case WebSession.EngineType.Trident
Return “Trident”
Case WebSession.EngineType.Unknown
Return “Unknown”
Case WebSession.EngineType.WebKit
Return “WebKit”
case else
Return “Unknown”
end select

case “Version”
Return Session.BrowserVersion

end select

Return “”

End Function[/code]

[quote=458359:@David Cox]This is what I wrote to let my Web App ask what type it was and return the result as plain English. Maybe Session.Browser and WebSession.BrowserType.XXXXXX will give you what you need?
[/quote]

David,

Your code is great, but the problem is that on an iPad under iOS13, WebSession.BrowserType is Safari. And WebSession.Platform is Macintosh.

I don’t see any way in the session object to tell that it is on iOS. That is the problem.

So here’s a picture first of the iOS Web Session Info:

Here’s the Mac:

No real difference. My Mac is still running 10.13 so the browser isn’t updated as high a level.

Not perfect or future proof, but what about checking if Browser type is Safari and BrowserVersion >= 13 ?

EDIT: Scratch that; it is on my desktop too…

[quote=458406:@Douglas Handy]Not perfect or future proof, but what about checking if Browser type is Safari and BrowserVersion >= 13 ?

EDIT: Scratch that; it is on my desktop too…[/quote]

Yup. iPad and Desktop showing exactly the same. Looks like I might have to completely modify my user interface to make it iPad acceptable.

I can’t use screen size any more either since iPads are getting much higher in resolution. The ONLY thing I see that maybe is a way out is the ScaleFactor property of the WebSession. I see on the iPad it is 2.0 and on the Mac it is 1.0. That might be a way…Not good as I’d need to see if ScaleFactor every increases to 2 on the desktop or decreases to 1.0 on the iPad.

Not sure if this will work for you, but you could detect it client-side in the browser with JavaScript (if you maybe have a splash/login page, say) and send that to the server as a cookie.

I don’t necessarily have a splash/login page. And what would that client side script be? And would it report anything different than the session?

There are some possible solutions floating around. See one example below. It seems like enough of a problem that Apple might provide a user-agent fix in an iOS13 update, but in the meantime a workaround like this might suffice.

[quote]As for me, the most simple way to detect iOS / iPad OS device now:

let isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)

The first condition is old-fashioned and works with previous versions, while the second condition works for iPad OS 13 which now identifies itself as “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)”, which by all platform detectors I know is not detected (for now) neither as mobile nor desktop.

https://stackoverflow.com/questions/58019463/how-to-detect-device-name-in-safari-on-ios-13-while-it-doesnt-show-the-correct[/quote]

Sounds like that might work but I’m not much of a JavaScript expert and am not sure how to get that value out of the self.ExecuteJavascript method of the page.

ok Xojo guys . . . Can you figure this one out?