PHP Mobile Detection
Thursday, September 11th, 2008Recently, I had a client request 2 versions of his website: one normal, and one for mobiles. Given that it was a “social” site that teenagers would probably access on their phone, it made sense. He wanted the content to be the same, just styled differently. While adding style=”handheld.css” came to mind, some phones help themselves to the screen media type (does anyone know what standards mean anymore?) so the owner requested a combination of both browser sniffing (which by the way isn’t the best way of doing things, don’t get me wrong) and media types.
Here’s how I did it.