otsukare Thoughts after a day of work

Detect And Redirect Users For Mobile Development

I have read today this long list of tips for Mobile Development. The tip about Detect and Redirect Users is not given with enough care outlining the issues related to user agent sniffing. So I left a comment. And I thought it might be useful for more people and I need to keep some of the points I made in there for memories.

Quite a list of tips. In the section “Detect And Redirect Users”, you recommend to use WURFL. It’s a choice which seems to be easy but which is in fact hard to maintain. There is a corollary of devices databases (any of them): It will break in the future.

The reason is quite simple, it’s a hard coded database of values. Browsers implementer not only evolve their browser engines but there are ported on more and more type of devices. One day or the other, you meet something which is not in the database and the site falls apart. Basically it is very fragile and not future friendly. People behind WURFL and other dbs make a tremendous and laudable work to maintain these lists, until the day they do not. For example, one of the major issues, Opera browser has right now is because of a library which is not maintained anymore and which was used in many powered Web sites.

So as a strategy, it is a lot better to use feature detections. Through JS APIs the Web developers can detect what is supported by the Web browser and then you send the appropriate interactions. This with a combination of mediaqueries will be a lot better.

Another point is the fallback. When developing the site, people should really have a readable fallback. Basically I encourage people to create a dumb user agent in their favorite browser and if the site fails with this dumb user agent, then there is an issue. Because it means one day or the other it will happen for a browser which was not planned.

Web sites are deployed put in production and sometimes never touched again. That would be bad to have them break because there were not planned for being future friendly.