www.webdeveloper.com
Results 1 to 6 of 6

Thread: How to redirect to mobile version of website?

  1. #1
    Join Date
    Jun 2013
    Posts
    4

    Question How to redirect to mobile version of website?

    I am having a website www.example.com and I am planning to design a new website for mobile users m.example.com. But how to redirect mobile users from main website to mobile version of website?

  2. #2
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    Look into User_Agents. This class prtty much does it for you: https://code.google.com/p/php-mobile-detect/

  3. #3
    Join Date
    Jun 2013
    Posts
    4
    That code helped in me in detecting the device. But how to redirect the to the mobile version. Can you help me in doing that?

  4. #4
    Join Date
    Jun 2007
    Location
    Tangerang, Banten
    Posts
    258
    What is your definition of mobile users?
    - if you mean users with specific device, such as iphone, do User Agent detection and redirect user using header location.
    - if you mean users with lower screen resolution, do JavaScript window width/height detection and do windows.location redirection.
    To the people inside it will feel like an earthquake.
    That should knock out the Greco.
    And that's your exit strategy.

  5. #5
    Join Date
    Jun 2013
    Posts
    4
    Thanks. But I am new to web designing. So can you help me with an example of both?

  6. #6
    Join Date
    Jun 2013
    Posts
    2
    First detect if the device is mobile or not.
    Use the ua-parser library for that,
    https://github.com/tobie/ua-parser/tree/master/php

    Next redirect using php headers or meta redirect.
    Most modern mobile browsers like android, ios and blackberry support php header based redirect.
    for older mobile browsers meta redirect should work

    regards
    silver

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles