|
Re: Web and Mobile Web
Hi dave...
Its all going to be based on user-agent string comparison and detection....
All you really need is a list of user-agents that are mobile ones and then handle them accordingly.
try - PHP: Select all
$mobile=0; $pda=0; $ipod=0;
$pdabrowsers = array( "Windows CE" ); if(preg_match('/('.implode('|', $pdabrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match)) { $pda=1; } else if (isset($_SERVER['HTTP_UA_OS'])) { if (strstr($_SERVER['HTTP_UA_OS'],"POCKET PC") !== false) { $pda=1; } }
$ipodbrowsers = array( "iPod", "iPhone" ); if(preg_match('/('.implode('|', $ipodbrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match)) { $ipod=1; }
if ($pda == 0 && $ipod ==0) { $mobilebrowsers = array( "WebTV", "AvantGo", "Blazer", "PalmOS", "lynx", "Go.Web", "Elaine", "ProxiNet", "ChaiFarer", "Digital Paths", "UP.Browser", "Mazingo", "iPhone", "iPod", "Mobile", "T68", "Syncalot", "Danger", "Symbian", "Symbian OS", "SymbianOS", "Maemo", "Nokia", "Xiino", "AU-MIC", "EPOC", "Wireless", "Handheld", "Smartphone", "SAMSUNG", "J2ME", "MIDP", "MIDP-2.0", "320x240", "240x320", "Blackberry8700", "Opera Mini", "NetFront", "BlackBerry", "PSP" ); if(preg_match('/('.implode('|', $mobilebrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match)) { $mobile=1; } elseif (strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml')) { $mobile=1; } elseif (strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml')) { $mobile=1; } }
It's not exactly tested, but should work with minor modifications
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com
I am currently unavailable for private work
|