/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class Client { /** * Available Mobile Clients * * @var array */ "midp", "240x320", "blackberry", "netfront", "nokia", "panasonic", "portalmmm", "sharp", "sie-", "sonyericsson", "symbian", "windows ce", "benq", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "samsung", "sda", "sgh-", "vodafone", "xda", "iphone", "android" ); /** * Check if client is a mobile client * * @param string $userAgent * @return boolean */ public function isMobileClient($userAgent) { foreach($this->_mobileClients as $mobileClient) { return true; } } return false; } } $client = new Client(); $client->isMobileClient($_SERVER['HTTP_USER_AGENT']);
URL: http://www.phpdevblog.net/2009/01/detecting-mobile-devices.html