SEVIZ Posted May 9, 2009 Share Posted May 9, 2009 Is there a way with php to detect if the user is on a normal web connection or a pda? I want to display a script in one way if via the normal web and another if they are coming from their pda. Basically one is a far more simple version. Thanks Quote Link to comment Share on other sites More sharing options...
ILMV Posted May 9, 2009 Share Posted May 9, 2009 You will net to check the user agent: $_SERVER['HTTP_USER_AGENT'] This will contain the information of the browser the user is viewing your site from, have a play around, you will need to research what user agents belong to PDAs and what don't, a simple if statement will allow you to change the site theme. ILMV Quote Link to comment Share on other sites More sharing options...
SEVIZ Posted May 9, 2009 Author Share Posted May 9, 2009 Thanks. Looked a bit and found this: <? if ( stristr($ua, "Windows CE") or stristr($ua, "AvantGo") or stristr($ua,"Mazingo") or stristr($ua, "Mobile") or stristr($ua, "T68") or stristr($ua,"Syncalot") or stristr($ua, "Blazer") ) { $DEVICE_TYPE="MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { $location='mobile/index.php'; header ('Location: '.$location); exit; } ?> Should work great. Figured I would post it for anyone else looking for the same thing. Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.