Is the Application running on a mobile device?
Download and use the class mobiledetect (http://mobiledetect.net) as an external library in your Scriptcase Application.
Usually you would have to add something like to add the library:
1 2 |
// Load Library require_once sc_url_library('sys', 'mobile_detect', '/Mobile-Detect-2.8.31/Mobile_Detect.php'); |
But it seems that Scriptcase already has included the library :/
Didn’t find any documentation about this at Scriptcase help …
Therefore you can build a new app of type blank and ad into onExecute Event:
We’ll build an application to check if a mobile device is used and call menu01 instead of menu02 (for PC displays).
To make it clear we’ll first use a code to show, which kind of device is used:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$detect = new Mobile_Detect; if ( $detect->isMobile() ) { echo "It's on mobile"; } else { echo "NO mobile"; } if( $detect->isAndroidOS() ) { echo "<br>... and it is ANDROID !<br>"; } |
Executing the app will show you if your app is running on a mobile or desktop PC.
If you want to call your apps menu01 or menu02, you can use some code like:
1 2 3 4 5 6 7 8 9 10 |
$detect = new Mobile_Detect; if ( $detect->isMobile() ) { sc_redir(menu01); } else { sc_redir(menu02); } |
Using a mobile device will call menu01