31 users online (0 members and 31 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 0
  2. js redirect    Forum: Javascript Forum
    Replies: 2
  3. Auto-Redirect    Forum: HTML Forum
    Replies: 1
  4. redirect advice please    Forum: Search Engine Optimization - SEO - Forum
    Replies: 4
  5. Setting cookies to remember drop down list    Forum: Website Scripts Forum
    Replies: 3
  1. #1
    John12's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2010
    Posts
    2

    Redirect and remember me

    Hi, I need some help. When a person goes to my website, and choices an option, eg. where they live, they will redirect to the page of that choice. But I would like it to go through a remember me feature, so when they return to my website, they do not have to go through the process of where they live. I hope you understand what im trying to explain.

    It is almost like emirates.com's website, where you specify your country, then when you return to the website, it redirects you, using a remember me feature, to your country's page.

    Thank you in advance

  2. #2
    John12's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2010
    Posts
    2

    Re: Redirect and remember me

    I have done even more searching for a code, theres a nice one here: http://www.perlscriptsjavascripts.co..._redirect.html
    Code:
    <script>
    <!--
    /* Copyright http://www.perlscriptsjavascripts.com 
       Free and commercial Perl and JavaScripts     */
       
    // page to go to if cookie exists
    go_to = "http://www.perlscriptsjavascripts.com";
    
    // number of days cookie lives for
    num_days = 60;
    function ged(noDays){
        var today = new Date();
        var expr = new Date(today.getTime() + noDays*24*60*60*1000);
        return  expr.toGMTString();
    }
    
    function readCookie(cookieName){
        var start = document.cookie.indexOf(cookieName);
        if (start == -1){ 
            document.cookie = "seenit=yes; expires=" + ged(num_days);
        } else {
            window.location = go_to;
        }
    }
    
    readCookie("seenit");
    // -->
    </script>
    It works fine, but as soon as i change the address it must redirect too, it doesn't redirect it to that page, only the place where i placed the code.
    Hope you understand,
    Thanks