Detect iOS devices: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
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..."
 
m Changed from Web Programming to Web Applications category
 
Line 44: Line 44:




[[Category:Web Programming]]
[[Category:Web Applications]]

Latest revision as of 14:06, 8 April 2020

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