Tom,
Here’s how we handled it. Basically it does a userAgent text, but follows that
up with an additional check for creating a TouchEvent if the userAgent includes
“Macintosh”, as it will if iOS is emulating Safari on a Mac.
This may fail when touchscreen Macs appear, but for now it does the trick:
function testios(){
//test for iOS
var ua = window.navigator.userAgent;
var testiOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;
if(testiOS){
return true;
}
//iOS v13 emulating Mac Safari:
if (ua.indexOf('Macintosh') > -1) {
try {
document.createEvent("TouchEvent");
console.log("tryiOS")
return true;
} catch (e) {}
}
return false;
}
var iOS = testios();
__
Ron Rosell
President
StreamLMS
> On Mar 6, 2020, at 12:12 PM, Tom Benedict via 4D_Tech <[email protected]>
> wrote:
>
> In iOS v13.x there is a new feature, called “Request Desktop Website”, which
> allows iPads and iPhones to pretend that they are desktop devices. It does
> this by returning a value in the UserAgent included in the HTTP Header which
> indicates “Macintosh" instead of “iPad" or “iPhone”. This new feature
> defaults to “On” in iOS13.x.
>
> The application I am supporting serves different HTML pages depending on
> whether a desktop or mobile device is detected during On Web Authentication.
> Currently our code parses the User Agent value returned by WEB GET HTTP
> HEADER to determine whether a desktop or a mobile page should be sent. Now
> that that approach is unreliable, I’m looking for another way to determine
> the hardware platform. I need something which I can reference with server
> side 4D code.
>
> What do others do in this case?
>
> Thanks,
>
> Tom Benedict
>
>
>
>
> **********************************************************************
> 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]
> **********************************************************************
**********************************************************************
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]
**********************************************************************