rkstevens Posted April 22, 2008 Share Posted April 22, 2008 Is there a way in PHP to be able to detect the media type of the user? I want to be able to detect if the user is using a handheld device (cell phone browser or smartphone) and do one of two things: have different code for handheld that uses less bandwidth; redirect to a different page. Link to comment https://forums.phpfreaks.com/topic/102345-find-device-user-is-using/ Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 There's gotta be a library for that. Go to Google and search a bit. "mobile device detection php". Link to comment https://forums.phpfreaks.com/topic/102345-find-device-user-is-using/#findComment-524029 Share on other sites More sharing options...
Fadion Posted April 22, 2008 Share Posted April 22, 2008 Try by detecting the user agent: <?php $userangent = $_SERVER['HTTP_USER_AGENT']; if(strstr($useragent, 'Blackberry')){ //where blackberry is the device echo 'You are on mobile'; } else{ echo 'You are on pc'; } ?> To check for several devices, make an array with all the devices. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/102345-find-device-user-is-using/#findComment-524053 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.