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

Passing Properties To Client

An optional include script can be added to a web page to provide information to client side JavaScript concerning the device, enabling decisions to be taken 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="/51Degrees.features.js.php" type="text/javascript"></script>

Individual properties can be requested by specifing them in a query string. A script tag and an example of output are given below:

<script src="/51Degrees.features.js.php?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.

Need Help?