1 0
Archive | February, 2009

Better iPhone User Agent Regex

David Walsh recently published a blog post detailing how to detect iPhone and iPod Touch users on your website via the user agent string, and while the concept is fine, I much prefer a slightly different method using regex to do the detection. In PHP: if(preg_match(‘/Apple.*Mobile.*Safari/’, $_SERVER[‘HTTP_USER_AGENT’])  {       header(‘Location: http://yoursite.com/iphone’);     [...]

Read More