For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > January 2006 > How to check the type of device/browser?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to check the type of device/browser?
wwwnmmm

2006-01-17, 4:01 am

Here's a web site. It's required to display different page layout for a user
who's using smart phone. If the user is browsing the site with a PC, it
should display full screen size page layout. If the user is reading with a
smartphone, it should show a pretty small size page layout. How to tell what
type of device the user is using?

Is it possible to check HTTP_USER_AGENT or other http header information and
see if the string 'windows ce' is in it?

Thanks a lot !
Pawel Janowski

2006-01-17, 8:03 am

HttpContext.Current.Request.Browser.IsMobileDevice


wwwnmmm

2006-01-17, 7:07 pm

Thank you for the help. Well I'm working for a web site with php executible.
The server environment does not support the statement I guess. Just tried the
codes below, not sure if it works or not ^_^

$BRUA="p"; // Type of the device, p for PC, m for mobile
if (stristr($_SERVER["HTTP_USER_AGENT"],"Windows CE")||
stristr($_SERVER["HTTP_USER_AGENT"],"NetFront")||
stristr($_SERVER["HTTP_USER_AGENT"],"Palm OS")||
stristr($_SERVER["HTTP_USER_AGENT"],"Blazer")||
stristr($_SERVER["HTTP_USER_AGENT"],"AvantGo")||
stristr($_SERVER["HTTP_UA_OS"],"POCKET PC"))
$BRUA="m";




"Pawel Janowski" wrote:

> HttpContext.Current.Request.Browser.IsMobileDevice
>
>
>

riki

2006-01-21, 9:57 pm

wwwnmmm wrote:
> Thank you for the help. Well I'm working for a web site with php executible.
> The server environment does not support the statement I guess. Just tried the
> codes below, not sure if it works or not ^_^
>
> $BRUA="p"; // Type of the device, p for PC, m for mobile
> if (stristr($_SERVER["HTTP_USER_AGENT"],"Windows CE")||
> stristr($_SERVER["HTTP_USER_AGENT"],"NetFront")||
> stristr($_SERVER["HTTP_USER_AGENT"],"Palm OS")||
> stristr($_SERVER["HTTP_USER_AGENT"],"Blazer")||
> stristr($_SERVER["HTTP_USER_AGENT"],"AvantGo")||
> stristr($_SERVER["HTTP_UA_OS"],"POCKET PC"))
> $BRUA="m";


that will work, or you can use js. see my ThemeChanger website, which
does that.

riki


This is a false statement
ThemeChanger for Smartphone : http://homepages.inspire.net.nz/~gambit/
AbstractStart for Smartphone :
http://homepages.inspire.net.nz/~gambit/AbstractStart/
Latest Betas have WM5 layout and speed dial support
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com