Hi Tom,

If your code is assessing the userAgent in the On Web Connection database 
method then you’d have an issue, because the code I provided relies upon 
testing the browser’s ability to  create a TouchEvent.  4D wouldn’t have a way 
to test that directly, but the browser can report its results back to the 
database.

If there’s a landing page for your site where people first log in, you could 
add some Javascript to that page that executes the code I provided to test for 
iOS v13 emulating Mac Safari.  If that returns true, you’d then need to track 
that information somehow.  You could keep it in a cookie, for example, and read 
that cookie in On Web Connection.  Or if 4D is managing sessions for you, you 
could store it it a process variable.  Or the browser could redirect the user 
to a different page on your site that is reserved as a starting point for iOS 
sessions.  (Again, keep in mind that you should also be supporting mobile 
displays on Android.). 

How exactly you’d handle it depends on aspects of your system design that I’d 
be wildly guessing about.  But the bottom line is you’d want to have the 
browser run the code that’s testing document.createEvent(“TouchEvent”), and 
then return the result to your back-end system, as a variable or a page 
request, to indicate that they’re running an iOS device.

If the only concern is page size as opposed to software features specific to 
iOS … that is, you want to present menus and so on that are optimized for 
mobile display … then rather than testing for iOS you might consider testing 
for the display size.  There are many ways to approach this, but here’s a good 
starting point (see the second recommended solution):

https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device
 
<https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device>

I hope this helps!

Ron
__

Ron Rosell
President
StreamLMS

301-3537 Oak Street
Vancouver, BC V6H 2M1
Canada

Direct phone (all numbers reach me)
Vancouver: (+1) (604) 628-1933  |  Seattle: (+1) (425) 956-3570  |  Palm Beach: 
(+1) (561) 351-6210     
email: [email protected] <mailto:[email protected]>  |  fax: (+1) (815) 
301-9058  |  Skype: ronrosell

> On Mar 7, 2020, at 5:04 PM, Tom Benedict <[email protected]> wrote:
> 
> Hmmm.. I’m not very web savvy so I’m not quite understanding how this works.
> 
> In our app, when a user enters a URL in their browser, code in the On Web 
> Connection database method in our app parses the HTTP header and gets the 
> UserAgent value, then it serves either a desktop or a mobile html page. So 
> the browser detection is in 4D, not on the web page. How would I do browser 
> detection on a web page? It seems like this might be a significant 
> architecture change.
> 
> Tom
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to