Mobile Browser Detection

Discussion in 'JavaScript' started by chrisfromboji, Jun 29, 2008.

  1. #1
    Hey,
    I'm working on a mobile website and need some help with my mobile browser detection script. I have it working for iPhone, iPod Touch, and Windows Mobile Devices.

    I need help getting it to detect for Blackberry Browser (Blackberry Devices), Blazer Browser (Palm Devices), Opera Mini Browser, Opera Mobile Browser, and other mobile browsers if possible.

    Does anyone know how to modify (and test if you have a phone to test with, as I don't have all of these devices) this javascript?:
    
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
    {location.replace("mobile.html");}
    if((navigator.appVersion.indexOf("Windows CE")>0))
    {location.replace("mobile.html");}
    
    Code (markup):
    Thanks for your help!
    -Chris
     
    chrisfromboji, Jun 29, 2008 IP
  2. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #2
    Social.Network, Jun 29, 2008 IP
  3. chrisfromboji

    chrisfromboji Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I looked at that site and it doesn't seem to have any mobile browsers. When I do get the agent strings for these mobile browsers, how do I implement the strings for detection of the whole platform or version spectrum?
     
    chrisfromboji, Jun 29, 2008 IP
  4. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #4
    Social.Network, Jun 29, 2008 IP
  5. handsetdetection

    handsetdetection Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    have you tryed handsetdetection.com?

    It detects the browser and then returns data back like screen size and device browser capabilities.
     
    handsetdetection, Jul 9, 2008 IP
  6. vinoth.t

    vinoth.t Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    We can detect the mobile browsers using the user agent at header. In PHP we have to save the mobile operator name in array compare the current user agent with the array if it match we can say the client using which mobile browser.
    Here the code to detect mobile browser php
     
    vinoth.t, Mar 21, 2011 IP