Jump to content

[SOLVED] Detect if on web or pda?


SEVIZ

Recommended Posts

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

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.