Mobile Browser Detection in PHP with RegEx

February 25, 2009 at 12:38 am Leave a comment

In October of last year, two thousand eight A.D., I stumbled upon a nice mobile browser detection script. Inspired by the comments, I modified the script to detect iPhones. I also made simple example scripts for two different ways of serving different content for different browsers, separate stylesheets or subdomains.

Today I received an e-mail requesting this modified script which had been removed from the file-sharing site, so I dug it up and updated it per brainhandles.com December 2008 update and and included detection of iPods, and Android devices separately from the iPhone, mobile, and desktop groups.

An without further ado, the code. (.zip 2.76kB / .tar.gz 1.76kB)

Entry filed under: php, Web. Tags: , , , , , .

An Open Letter to Rep. Linda S. Bolon

Leave a comment

Trackback this post  |  Subscribe to the comments via RSS Feed


Archive

February 2009
M T W T F S S
 1
2345678
9101112131415
16171819202122
232425262728