I need a code for redirecting mobile users to another page on my site

Discussion in 'HTML & Website Design' started by jasontn, Mar 3, 2010.

  1. #1
    I could also use a code for hiding videos for mobile users. Otherwise I need some kind of redirecting code. My site GuitarLessons.Mobi isn't adjusted for mobile users. If mobile users access it then it would eat up bandwidth.


    I have another question if I rewrite the DTD declerations for mobi then will the videos still display the same for non-mobile users?

    Here is one useful link for detecting mobile users but it doesn't redirect

    http://www.hand-interactive.com/resources/detect-mobile-javascript.htm

    I found one code on net. But I haven't tested it. If somebody wants to test it then please tell me how it goes.

    From http://detectmobilebrowser.com/ (Javascript code) (This redirects mobile users to a page or another site suitable for mobile users)

    http://mlearningworld.blogspot.com/2007/01/two-scripts-to-detect-mobile-browser.html (This is one I will probably add because it's simpler)
     
    Last edited: Mar 3, 2010
    jasontn, Mar 3, 2010 IP
  2. pedro_sland

    pedro_sland Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I suggest that you put a site that is good for mobiles on a .mobi domain since that is what it is for. For pcs I would suggest buying eg a .com.

    Why can mobile visitors not visit your site?
     
    pedro_sland, Mar 3, 2010 IP
  3. jasontn

    jasontn Well-Known Member

    Messages:
    1,003
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    175
    Digital Goods:
    1
    #3
    <script>var isCE = navigator.appVersion.indexOf("Windows CE")>0;if (isCE){ window.location.href="http://www.guitarlessons.mobi/mobi.htm";}</script>

    I put a redirect code on my site. Try it out and see if it works. This is so the videos don't eat up the bandwidth for mobile phones. Only the homepage and a few other pages have the code right now.

    The code is in the <head> tags so it should activate before the videos have a chance to use up cell phone bandwidth.

    The domain is good for SEO. Anyways, who looks for guitar lessons on a cell phone anyways? But if anybody does I am prepared.
     
    jasontn, Mar 3, 2010 IP