I’m now using this code that should detect properly most mobile brands:
/* Return TRUE if user is using mobile phone browser */
function ismobile(){
$useragent = $_SERVER['HTTP_USER_AGENT'];
// Standard vendor-model/version user agents
if (preg_match(’/^((ACERlcatelUDIOVOXlackBerryDMricssonG\bGEotorolaOTECokiaanasonicCIAGEMAMSUNGECanyoendoHARPIEonyEricssonelitelit_mobile_TerminalsSM)[- ]?([^\/\s\_]+))(\/(\S+))?/’, $useragent)){
return true;
}else{
return false;
}
}
July 25, 2008
Detecting if user-agent corresponds to mobile phone
- Top 10 SEO Mistakes
- How to Find a Niche?
- Using ADSENSE and MICRO NICHE SITES
- Free Unique Content for your blog/site
- Title Tags and Headings