Passing Properties To Client Side
An optional include script can be added to the web page to provide information to client side JavaScript concerning the device enabling decisions to be made client side. The script returned will create an object called FODF (51Degrees Features) which can be used to request properties. For example the following JavaScript would return the IsMobile value.
if (FODF.IsMobile) { // Do something for mobiles only. }
The value returned will be of a type associated with the property. See the Property Dictionary for details of property types.
The necessary javascript includes need to be added into the page by the developer. The following needs to be added to the HTML page header before accessing the FODF variable.
<script src= "/portals/0/51D/features.js" type= "text/javascript" > </script>
Individual properties can be requested by specifying them in a query string. A script tag and an example of output are given below:
Tag:
<script src= "/51D/features.js?IsMobile&BrowserName&BrowserVersion" type= "text/javascript" > </script>
Response:
var FODF = { IsMobile : false , BrowserName : "Chrome" , BrowserVersion : 33 };