Detect iOS devices

From DataFlex Wiki
Revision as of 12:31, 24 February 2019 by Wil (talk | contribs) (Created page with "=== Author and origin === This example code was written by Harm Wibier after a request from Tom Murphy and comes from the following post at the forum: https://support.dataac...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Author and origin

This example code was written by Harm Wibier after a request from Tom Murphy and comes from the following post at the forum:

https://support.dataaccess.com/Forums/showthread.php?63853-df-sys-isIOS

Detect iOS

There are times where you need to handle differences between android and iOS devices.

Can this setting be exposed in the DataFlex backend like df.sys.isMobile and pbIsMobile. If this could be extended to a mode setting like iOS|android|windows etc.. that would be great to.

Currently this is not yet available (DF 19.1) from within the framework.

How-to

You could do it yourself with a little custom JavaScript.

You could subclass the df.WebApp class to add the property. Of course you should then also change index.html to use your subclass.

df.MyWebApp = function(sWSO){
    df.MyWebApp.base.constructor.call(this, sWSO);

    this.prop(df.tBool, "pbSysIsIOS");
    this.addSync("pbSysIsIOS");
}
df.defineClass("df.MyWebApp", "df.WebApp", {
    get_pbSysIsIOS : function(){
        return df.sys.isIOS;
    }
});

var oWebApp = new df.MyWebApp("WebServiceDispatcher.wso");

In DataFlex:

{ WebProperty=Client }
Property Boolean pbSysIsIOS False