How to use Node.js API
Include the following code in to your project .js file/files you want detection to take place in:
The above code will log the most basic information about requesting device to console. The requesting device in this case being a blackberry device. Of course simply outputting this information is not very useful. To integrate detection into your website logic each property can be accessed individually as shown below:
The above examples will always fetch a pre-defined list of properties. You can also instruct detector to fetch specific properties, or all Lite properties. The following example fetches all Lite properties:
To manually specify desired properties you can supply an array of properties as a second parameter for the new Parser() line. For example:
Please note that supplying properties that can only be found in a Premium or Enterprise data files will not return any result for the properties in question. I.e. using the above example with Lite data file will only return IsMobile and ScreenPixelsWidth properties but not the DeviceType property.