• About Us
  • Blog
  • Basket
  • Account
  • Sign In

Java V3.1 Documentation

You are viewing an old version of the documentation. For the latest, please go here: Java V3.2

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:


<script src="/51D/features.js?IsMobile&BrowserName&BrowserVersion" type="text/javascript" > </script>


var FODF={ IsMobile:false, BrowserName:"Chrome", BrowserVersion:33 };

An example of this generated by the .NET API can be found at 51Degrees.features.js.