April 21, 2012
WURFL is a service used to detect mobile devices. Stated on their web site, WURFL “is a Device Description Repository (DDR), i.e. a software component which contains the descriptions of thousands of mobile devices. In its simplest incarnation, WURFL is an XML configuration file plus a set of programming APIs to access the data in real-time environments.”
WURFL is used by various products, but can also be used directly in your web site. If you are using .NET, whether web forms or MVC, you can get instructions on how to set it up here: http://wurfl.sourceforge.net/dotNet/
I had trouble getting the base installation to work correctly; I was getting a random error when it attempted to build the manager based on the configuration. It was probably something I wasn’t doing, so to quickly get support up and running, I chose to write my own wrapper around instantating of the manager. Note that in this example, hard-coding the file strings was OK for me, since this was inside a web site and I was doing the same task over and over again. If this was a reusable solution, passing these parameters in is preferred.
The approach I took was to provide a lazy load, checking from cache first if the object exists, then instantiating it and storing in cache if it doesn’t. This way, the instance is always guaranteed to be present.