WURFL.io

Device Detection with WURFL.js


WURFL.js is JavaScript that detects device models of smartphones, tablets, smart TVs and game consoles accessing your website. Starting with iOS 12.2, only WURFL.js Basic, Standard, and Pro services will detect iPhone and iPad models. The free WURFL.js Lite will only return generic iPhone and iPad results.


To use the free WURFL.js Lite, all you need to do is sign up for an account and insert the following script into your page.


<script src="//wurfl.io/wurfl.js" crossorigin></script>

Once loaded, the snippet will quickly request WURFL device capabilities from ScientiaMobile’s highly-available cloud-based WURFL detection solution. The WURFL results are delivered back to you, resulting in a JSON object. For example, you can check if a device is a smartphone by testing the form_factor WURFL capability.

if (WURFL.is_mobile === true && WURFL.form_factor === "Smartphone") {
    // targetSmartPhoneDevices();
}

Or, you can test for an individual iPhone model by using the complete_device_name. (Note that full iPhone model is only available in commercial WURFL.js Basic, Standard, or Pro licenses.)

if (WURFL.complete_device_name === "Apple iPhone XR") {
    // targetAppleiPhoneXR();
}

For example, your current device looks like:

{
    "is_mobile": <% WURFL.is_mobile %>,
    "complete_device_name": <% WURFL.complete_device_name %>,
    "form_factor": <% WURFL.form_factor %>
}

In development, you may pass debug=true to the query string to disable any caching.


Below are the capabilities included in the free WURFL.js Lite:


complete_device_name
Concatenation of brand name, model name and marketing name (where available) of a device into a single string. (Note that full iPhone model is only available in commercial WURFL.js Basic, Standard, or Pro licenses.)
form_factor
May return any of these values: DesktopTabletSmartphoneFeature PhoneSmart-TVRobotOther non-MobileOther Mobile
is_mobile
Returns true if the device is wireless (e.g. Wi-Fi, 3G, LTE). Specifically, a tablet or mobile phone is considered wireless. Otherwise, a desktop or laptop are false.

Need a more detailed analysis? WURFL.js Basic, Standard and Pro plans include 24 WURFL device capabilities.


Based on this device intelligence, you can build code to support mobile optimization, more targeted and effective advertising, and collect analytics on device capabilities. For example, this current page uses WURFL.js to optimize the UX depending on what type of device you are using to visit it.


  1. Desktop devices see a video background on the top of the page.
  2. Mobile devices see a background image.
  3. Navigation is optimized to your device's form factor.
  4. Google Analytics is collecting information about the device through custom variables.

Need a Commercial License?

WURFL.js Basic, Standard, or Pro offer a commercial license that also includes:

  • • Full iPhone and iPad model detection
  • 24 device capabilities
  • • Custom CNAME alias and SSL certificates
  • • Ticketed Enterprise support
  • • Browser caching for improved performance

Advertising

If you monetize your site using advertising, you may rely on multiple ad networks. Using WURFL.js, you can direct mobile traffic to ad networks that more effectively target mobile users. You can also pass on more complete information (e.g. iPhone model) that may enhance bids and increase your CTR.

iPhone Model

Apple makes detection of specific models of iPhone and iPad very difficult. With commercial WURFL.js Basic, Standard, or Pro plans, you receive a detailed description of the full model name (e.g. “Apple iPhone XR”), along with many other device parameters. You can pass this information on to your analytics platform (e.g. Google Analytics) or use it to customize experiences to specific iPhone models.

Analytics

Designing a great user experience starts with knowing your users. WURFL.js provides information that is not available elsewhere. This information can be put into analytics tools such as Google Analytics and be the basis for custom reports that are more accurate than the standard ones.