Posts tagged ‘regex’

Mobile Browser Detection in PHP with RegEx

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)

Advertisements

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


Archive

October 2017
M T W T F S S
« Feb    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Recent Posts