ScientiaMobile Wurfl Cloud Client for Node.js

Introduction

The WURFL Cloud Service by ScientiaMobile, Inc., is a cloud-based mobile device detection service that can quickly and accurately detect over 500 capabilities of visiting devices. It can differentiate between portable mobile devices, desktop devices, SmartTVs and any other types of devices that have a web browser.

In order to use the WURFL Cloud client you need to obtain an API key from Scientiamobile. The WURFL Cloud API is offered in two main flavors - Base and Premium. The Base version is limited to returning only a small number of capabilities; the Premium version doesn't have an upper limit to the number of returned capabilities and also offers more caching options for improving the overall performance. Once you've properly set up an account, you can download the cloud client and receive an API key to successfully use the library. You can create an account by visiting ScientiaMobile.com.

Installation

Download and extract NodeWurflCloudClient and Libraries folders in the folder where your Node code is.

Note: Node.js version 0.8.2 is required.

Include the following lines in your code:

var wurfl_cloud_client = require("./NodeWurflCloudClient/WurflCloudClient");
var config = require("./NodeWurflCloudClient/Config");

Configuration

Set API Key:

var api_key = "XXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";
var configuration = new config.WurflCloudConfig(api_key);

Testing

After you have installed and configured the WURFL Client, put this code in a file:

var brand;
var result_capabilities = {};
var WURFLCloudClientObject = new wurfl_cloud_client.WurflCloudClient(configuration, HttpRequest, HttpResponse);
WURFLCloudClientObject.detectDevice(HttpRequest, null, function(err, result_capabilities){
    WURFLCloudClientObject.getDeviceCapability('brand_name', function(error, brand){
        if(error!=null){
            console.log('Error' + error);
        }else{
            console.log('Brand name: ' + brand);
        }
    });
});             

You should see the brand name of your device in the console provided that you have already obtained a WURFL Cloud API key and that you have selected brand_name in your capabilities section. Visit WURFL Cloud Client - Getting Started for more information.

Example application

After you have registered in WURFL Cloud Service here, to run the example application on you browser do the following:

  • Download and extract all the files in the folder.

  • Inside the exampleApp.js enter your own WURFL Cloud API key.

  • Select brand_name and is_wireless_device as your capabilities in ScientiaMobile WURFL Cloud website.

  • Run the server/example application inside a console by node index.js.

  • Go to a Web Browser in http://localhost:8888

  • Either chose example or example2. You should see the brand name of your device and whether it is wireless or not.


© 2025 ScientiaMobile Inc.
All Rights Reserved.

NOTICE: All information contained herein is, and remains the property of ScientiaMobile Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to ScientiaMobile Incorporated and its suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from ScientiaMobile Incorporated.