How to know if web app is being accessed from a mobile phone?

Hello:

I am building a webapp in Xojo and I want to have two sets of webpages:

One that is best-suited to be displayed on a mobile device (such as a smart phone) and the other page(s) that will be best-suited for desktop/laptop viewing.

Is there a way in Xojo to detect whether the end user is accessing the web app with their mobile device? Does it have something to do page dimensions or something?

Var Mobile As Boolean = (Self.Header("user-agent").Contains("Android") _
Or Self.Header("user-agent").Contains("iPhone"))

In the session opening event handler should get you started.