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. 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.

Important Note: More recent iPads will impersonate a desktop browser through the User-Agent string. WURFL.js Basic, Standard and Pro services will still be able to detect the device as an iPad (thanks to sophisticated additional logic), and return information about the specific model. The free version (WURFL.js Lite) will handle those devices as desktop browser.


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="https://wurfl.io/wurfl.js"></script>

A detailed guide for getting started with WURFL.js Lite is available here.


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 && 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 14 Pro") {
    // targetAppleIPhone14Pro();
}

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.


WURFL.js is fully compatible with Chromium's User-Agent Client Hints (UA-CH) initiative. If User-Agent Client Hints are absent in the HTTP headers that WURFL.js receives, the service will automatically fall back to using the User-Agent Client Hints' JS API to fetch high entropy client hint values from the client device. However, we recommend that you explicitly opt-in/advertise support for User-Agent Client Hints on your website and delegate them to the WURFL.js service for the fastest detection experience. Our documentation regarding implementing User-Agent Client Hint support is available here.


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 the full iPhone model is only available in commercial WURFL.js Basic, Standard, or Pro licenses.)
form_factor
May return any of these values: Desktop, Tablet, Smartphone, Feature Phone, Smart-TV, Robot, Other non-Mobile, Other 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 is 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.

A detailed guide for getting started with WURFL.js Basic, Standard and Pro plans is available here.

To get in touch with our support team and connect with the WURFL community, you can join the WURFL Discord channel.

For enterprise support, please use our Enterprise Support Portal.


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 14 Pro”), 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.