Apple’s iPhone has sparked a great deal of interest and excitement in mobile web application development. The iPhone significantly raises the bar for the capabilities of mobile devices. Its large screen and advanced browser will allow for the development of applications never before seen on mobile devices. That said the iPhone will be one device in a vast ocean of mobile users. Developers of mobile web applications will need to provide a version of their app that supports in some way those other devices.

One of the largest problems facing prospective mobile developers is adapting content to the numerous sizes and styles of mobile devices. Screen size, network speed, image format and markup language support are just a few of the variables to consider. Even the iPhone when on the carrier network, is limited to the dial-up speed GPRS network. To compound the problem mobile carriers and handset manufactures are releasing new phones daily in an attempt to one-up their competitors. If you are planning on creating a mobile version of your web app there are open-source tools available that will make your job a little easier.

Wireless Universal Resource File (WURFL) is an open-source XML database of mobile device capabilities and features. WURFL works by providing a mapping between a user-agent string and a set of properties about the device. To keep the database space efficient they store the devices in a hierarchy where it only store the attributes that differ from device to device. The following quote was taken from the page titled What’s cool about the WURFL?

After all we already have 400 or more devices times 100 or more capabilities. The matrix is pretty large and it will only grow larger. To make things more complex, each device may have several subversions (often corresponding to different version of the firmware).

Building such a huge matrix is not necessary, though, and this is where the WURFL is smarter than other solutions.
Consider these facts:

  • browsers are different, but they also have many features in common with one another.
  • browsers/devices coming from the same manufacturer are most often an evolution of the same hardware/software. In other words, differences between, say, a Nokia 7110 and a Nokia 6210 are minimal.
  • devices from different manufacturers may run the same software. For example, Openwave Systems provides the browser to Siemens, Motorola, Alcatel, Mitsubishi, Samsung, Panasonic, Telit and Sagem…just to name a few.

exploiting these assumption allows the WURFL to be:

  • very compact and small as compared to the complete matrix
  • very simple to update.

WURFL has libraries written in Java, PHP, Perl, Ruby, Python, dotNet, and C++.
For a developer the interface is simple. Give the API a user-agent string and it will attempt to return the most specific match it can find for a device. Once you have the device then you can use the map of capabilities it provides to change the content you send back to the user. Does their device support XHTML or just WML? How large can the images be, and in what format?

The contributors also attempt to provide user interface optimization hints: does the device render tables correctly (xhtml_table_support)? Will it display background colors (xhtml_honors_bgcolor)? Or how select form elements are displayed to the user (xhtml_select_as_dropdown, xhtml_select_as_radiobutton, xhtml_select_as_popup)? WURFL can help you answer these questions.

With WURFL your application could automatically detect the iPhone user-agent and create a page and images that are optimized for its large screen size and rich rendering and scripting capabilities. Images could be re-sized from the desktop to iphone resolution to save bandwidth and decrease load times.

WURFL has sub-projects built on the library. One in particular is a Java Servlet that will transcode an images into the proper format, size and color depth for the requesting device.

WURFL does not provide a magic bullet that will make mobile web application development painless, but it it is a major step in the right direction. There are many features and details of WURFL that I have left out of this brief overview. Go check it out for yourself and see if WURFL is right for your mobile web project. Like all other open-source projects it is only as good as the contributions made to it. So if you are currently developing mobile web applications check out their contributions page to find out how you can make sure the user-agent strings you are seeing in your server log files are found in the WURFL database.

The difficulties and inconsistencies with mobile web app development make the desktop browser inconsistencies of the late 1990s seem tame. As more of our customers ask us to create mobile versions of their web apps, it is great to see resources and tools such as WURFL emerge to make the process a bit more sane.