This is the second in a series of tutorials explaining how to detect mobile devices and so direct a user to a mobile optimised page.
Who is this tutorial for?
It will be helpful to have read the first in the series: Part 1: The User Agent String.
This tutorial assumes an intermediate level of PHP and xHTML
The Problem of Multiple Devices
In the last tutorial, we looked at how to detect one platform, by grabbing the user agent string, comparing it against the text for ‘iphone’ or ‘ipod’, and then redirecting to an iPhone-optimised web page.
However, there are a myriad of mobile devices in the world. Each mobile device has a browser, some of which are the same (e.g. Opera Mini, or a standard browser for Nokia Series 40), but many are different, and therefore return different user agent strings. It’s also worth noting that sometimes re-releases of the same handset will modify the user agent string slightly.