Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I detect for a mobile device?

    I have a standard HTML website, but I want to be able to detect when a client is comming from a mobile device, such as a PDA or a Mobile phone.

    What is the best way to do this? and is it possible to determine the screen resolution of the device?

    Thanks,

    Fernando

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    go for resolution check

    Hello. Go for the resolution check option and redirect to relevant pages for each resolution you build the site for.
    Therapy is expensive, popping bubble wrap is cheap, you choose.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is a website: http://www.dailyf1.com/en/
    this is the PDA version of the same site: http://www.dailyf1.com/en/pda/index.phtml
    It's not only about resolution.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #5
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Most WAP-enabled devices only have a viewing area of 150x150. You can only reliably detect if they are a WAP enabled device by using a server-side language to check to see if the device accepts certain things, things that are unique to wireless devices.

    Basically you check to see if the browser accepts text/vnd.wap.wml. If it does accept this, then it is a WAP enabled device, and thus a handheld.

    You would also probably want to check if it is a pocket PC, so then would check if the HTTP_USER_AGENT is Windows CE. If it is, than again, you have a WAP enabled device.

    You cannot use JavaScript to do this, as WAP devices do not offer full (and sometimes no) support of scripting blocks or advanced features. It will often simply not parse them.

    So in ASP you would use:
    Code:
    If (InStr(Request.ServerVariables("HTTP_ACCEPT"), "text/vnd.wap.wml")) or (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows CE"))  then
            'redirect to WAP area 
    End If
    in PHP (which I would recommend) it would be:
    PHP Code:
    if ((strpos($HTTP_ACCEPT,'text/vnd.wap.wml')) or (strpos($HTTP_USER_AGENT,'Windows CE'))) {
        
    //this is a WAP device

    Technically, you could also do this through a .htaccess file that would affect your site globally, but I haven't tried it (though it would seem to work easily and not require you to have to touch all pages within a site).
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #6
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Don't you need to use WML for wireless pages? Or do Wireless devices have HTML parsers now?

  • #7
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    I dunno... I know Google works on a PDA, do they use WML?

  • #8
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Most devices will parse (they refer to it as 'converting from HTML') to a WML hybrid they can read. WML isn't as mush as a consideration as it once was, but it is still the only reliable way to have a page display within a WAP device properly. (also, since WAP devices don't parse certain functions, only have 4 methods of navigation; so typically a entire new site is served up that strips everything but the bare essentials.) The sites that are really serious about wirelss device accessibility use CMS's that detect a WAP device and alter their layout accordingly, dynamically.

    Also, remember that the estimates of wireless device users of the internet is absolute crap...it is a complete lie. 1 billion wireless internet ready devices by 2003...and realize that 99% of that number simply do not use those devices for internet access at the moment, even if their device is ready...those stats simple count how many devices can use the internet, now how many actually do; it is a pipe dream right now: the devices are (for the most part) far too limited for web use.
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •