Website Redirection Help

Discussion in 'Mobile Web Development' started by jchaike, Mar 23, 2008.

  1. jchaike

    jchaike Active Member

    Joined:
    Dec 26, 2007
    Messages:
    1,260
    Likes Received:
    3
    Device:
    iPhone 4 (Black)
    So I have a website, and I have a flash portion (for the computer) and a iPhone part (obv for the iPhone.iPod).

    I have been searching for a very long time, but I cant seem to find a redirection code that I understand. I want it to kind of say this:

    If browser = iPod/iPhone then redirect to "iphonewebsite.com" else "pcwebsite.com"

    not real web addresses because last time i posted my website link the topic got closed =/
    but there is a link in my sig for the iphone version portion.
  2. Max

    Max New Member

    Joined:
    Sep 18, 2007
    Messages:
    67
    Likes Received:
    1
    Device:
    iPhone
    In the head part of the website put this little java script

    <script language=javascript>
    <!--
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
    {
    location.replace("http://www.yourIphoneWebsite.html");
    }


    It works like a charm!
  3. blackjak231

    blackjak231 Member

    Joined:
    Oct 1, 2007
    Messages:
    759
    Likes Received:
    6
    Device:
    iPhone 4 (White)
    I just tried yours Max, and it worked like a charm!!!

    Please Register or Log in to view images


    As for me, i used some code in an "index.php" file that either redirected the user to an iphone/ipod touch website, or to a computer website!
    Look in the thread 100% iphone website for the code!

Share This Page