Last active
September 6, 2016 21:40
-
-
Save GiancarloGomez/1ccb627fb0504b67022aeb1e4d7ab65d to your computer and use it in GitHub Desktop.
An example Struct using the ColdFusion MobileDetect CFC : https://github.com/GiancarloGomez/ColdFusion-MobileDetect/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
session.agentCheck = { | |
version : MobileDetect.getVersion(), | |
checkedOn : now(), | |
isMobile : MobileDetect.isMobile(), | |
isTablet : MobileDetect.isTablet(), | |
isIpad : MobileDetect.isIPad(), | |
isAndroid : MobileDetect.isAndroidOS(), | |
isIOS : MobileDetect.isIOS(), | |
// Example of how to define a Cordova app when using the AppendUserAgent option in the Config.xml | |
// In this test I check for cordova which is what I append or Crosswalk | |
isCordova : MobileDetect.match("cordova|Crosswalk"), | |
// desktop version | |
isMacSafari : MobileDetect.match("Macintosh(.*)Version(.*)Safari"), | |
isPhone : MobileDetect.isMobile() && !MobileDetect.isTablet() ? true : false, | |
// Example of how I define a new version for a Cordova App | |
newCordova : MobileDetect.match("cordova 2|Crosswalk/17|cordova_in_browser") | |
}; | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment