[Web4lib] Mobile identification code

Ken Irwin kirwin at wittenberg.edu
Wed Aug 25 12:33:58 EDT 2010


Dawn,

I've been using to different sources of mobile-detection code. 

For our library website, where I have access to PHP, I use the code downloadable from:
http://detectmobilebrowsers.mobi/
(Free for non-commercial use, commercial license fees apply otherwise)
The PHP is truly elegant, and I like it quite a bit.

For our library catalog, where we can't execute PHP code, I use an excerpt of the JavaScript code available at:
http://detectmobilebrowser.com/
This is a less elegant approach, but it works.

You can also do some non-script-based detection using the media attributes of a CSS <link> tag, but that path is fraught with peril. An intro to this approach can be found in Jonathan Stark's excellent book _Building iPhone Apps with HTML, CSS, and Javascript_ from O'Reilly. (see p16). 

I strongly recommend that book (and probably its forthcoming Android-app companion book) to anyone interested in learning to build mobile-friendly websites. Despite the "iPhone app" orientation of the title, it is an excellent introduction to building mobile websites. (I'm really surprised that I've not found any other books that really plumb this territory. I'm curious if anyone else has, but I should probably post that as a separate thread.) 

Good luck,
Ken




More information about the Web4lib mailing list