Skip to content

Instantly share code, notes, and snippets.


benmay/mysite_is_mobile..php Secret

Created May 21, 2013
What would you like to do?
function mysite_is_mobile()
$isMobile = preg_match("#(ipod|iphone|android|opera mini|blackberry|pre/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)#i", $_SERVER['HTTP_USER_AGENT'] );
// If an IP is X then show mobile (good for debugging m site)
// if( $_SERVER['REMOTE_ADDR'] == '' )
// return true;
return $isMobile == 1 ? true : false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.