Mobile Redirect

Discussion in 'PHP' started by MajHate, May 12, 2009.

  1. #1
    MajHate, May 12, 2009 IP
  2. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Unfortunately, there is no easy way to detect whether the user is on a mobile device. The two biggest options for you are probably DeviceAtlas (commercial) and WURFL (free). A Google search on either of those will point you in the right direction.
     
    Gordaen, May 12, 2009 IP
  3. X-N2O

    X-N2O Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just check the User-Agent, and redirect it to the mobile version.
    Check out $_SERVER['HTTP_USER_AGENT']
     
    X-N2O, May 13, 2009 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    And maybe take a look at the browscap.ini file - it has to be enabled in php.ini, and if you are on a shared hosting, it might not be loaded, but it's a very neat addition if you want to check differences in lots of browsers.

    You can find the "official" browscap.ini here: http://browsers.garykeith.com/downloads.asp
     
    PoPSiCLe, May 13, 2009 IP
  5. AdscendJeremy

    AdscendJeremy Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yep, this is the best way. Also if you Google "user agent mobile" (w/o quotes) there are pages which will tell you what user-agents to look for.
     
    AdscendJeremy, May 13, 2009 IP
  6. AshDaFlash

    AshDaFlash Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I have found that a lot of mobile redirecting scripts need to be updated constantly and always include Iphones in the redirecting process. If anyone is interested, I've uploaded a PHP script to the following website:

    Go to: http://www.pcmechanix.ca/mobile_redirect.htm

    If you would first like to test the code using a mobile device then input the following url into your mobile browser:

    http://www.pcmechanix.ca

    Good Luck!
     
    AshDaFlash, May 21, 2009 IP