Results 1 to 7 of 7
  1. #1
    Help redirecting to mobile site
    bassguy86's Avatar
    Member Since
    Feb 07, 2010
    Posts
    58
    Specs:
    MacBook Black 2.4 GHz Intel Core 2 Duo, 4GB 667 MHz DDR2 SDRAM 320gb 7200rpm HDD Snow Leopard
    Smile Help redirecting to mobile site
    I have a portfolio site and am wanting to make it auto detect and redirect to the mobile version. I have a mobile version created but I am having trouble understanding how to do this. Any help is appreciated.
    Check out some of my Design work.
    www.jonnypye.com

  2. #2
    Help redirecting to mobile site

    Member Since
    Nov 29, 2010
    Location
    Vancouver, BC, Canada
    Posts
    27
    Specs:
    Black 13.3" MacBook 4,1 Intel Core2 Duo, 4Gigs Ram (2x2G), 2.4GHz, OS X 10.7.2
    Code:
    <script type="text/javascript">// <![CDATA[
     var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
     if (mobile) { document.location = "http://www.youtube.com";}
    // ]]></script>
    The above code should redirect a mobile browser to youtube. So, just replace the youtube url with the url of your mobile site.

  3. #3
    Help redirecting to mobile site
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,398
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    If the above doesn't work, there's always the wonderful MooTools Browser class (see here) that can detect platform.

    Take a look at this page I created a while back. All it does is print back some info about the browser and platform of the user using MooTools. It doesn't redirect but it does show how easy it is to use MooTools to do basic detection. Feel free to take what you need from the source.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  4. #4
    Help redirecting to mobile site
    bassguy86's Avatar
    Member Since
    Feb 07, 2010
    Posts
    58
    Specs:
    MacBook Black 2.4 GHz Intel Core 2 Duo, 4GB 667 MHz DDR2 SDRAM 320gb 7200rpm HDD Snow Leopard
    Quote Originally Posted by DenAtTheDBM View Post
    Code:
    <script type="text/javascript">// <![CDATA[
     var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
     if (mobile) { document.location = "http://www.youtube.com";}
    // ]]></script>
    The above code should redirect a mobile browser to youtube. So, just replace the youtube url with the url of your mobile site.
    I tried putting in the .mobi version of my site and it gave a "bad gateway" response. Is there a way I could put the path to the mobile folder on my server in the youtube spot and it work?
    Check out some of my Design work.
    www.jonnypye.com

  5. #5
    Help redirecting to mobile site
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,398
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    If you use DenAtTheDBM's solution, you will need to replace the YouTube URL with an appropriate path. How were you trying to do it?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  6. #6
    Help redirecting to mobile site
    bassguy86's Avatar
    Member Since
    Feb 07, 2010
    Posts
    58
    Specs:
    MacBook Black 2.4 GHz Intel Core 2 Duo, 4GB 667 MHz DDR2 SDRAM 320gb 7200rpm HDD Snow Leopard
    Quote Originally Posted by vansmith View Post
    If you use DenAtTheDBM's solution, you will need to replace the YouTube URL with an appropriate path. How were you trying to do it?
    I was replacing youtube.com with jonnypye.mobi should I use the mobile folder path under jonnypye.com instead? What would that be? index/mobile I would guess since the mobile folder is nested in the main directory. [Main folder/mobile]

    EDIT: putting the mobile folder path worked! Thanks for the help!
    Check out some of my Design work.
    www.jonnypye.com

  7. #7
    Help redirecting to mobile site
    bassguy86's Avatar
    Member Since
    Feb 07, 2010
    Posts
    58
    Specs:
    MacBook Black 2.4 GHz Intel Core 2 Duo, 4GB 667 MHz DDR2 SDRAM 320gb 7200rpm HDD Snow Leopard
    Now for a follow up question: Is there a way to put a link to full site that will bypass the auto redirect?
    Check out some of my Design work.
    www.jonnypye.com

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Vudu avoids Apple rev share split with iPad mobile site
    By OneMoreThing... in forum Apple Rumors and Reports
    Replies: 0
    Last Post: 08-10-2011, 06:20 AM
  2. Mobile App and/or Mobile Site layout
    By CaldwellYSR in forum Community Suggestions and Feedback
    Replies: 12
    Last Post: 05-24-2011, 10:00 PM
  3. Suggestions for mobile site
    By fearlessfreap24 in forum Community Suggestions and Feedback
    Replies: 0
    Last Post: 05-21-2010, 10:23 AM
  4. Mobile Site?
    By therichad in forum Community Suggestions and Feedback
    Replies: 1
    Last Post: 08-11-2009, 03:53 PM

Posting Permissions

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