Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Set Cookie for browser session only

    Greetings,
    What do I need to change here so that when the popup loads it will not reload when a visitor returns to the page during a visit. I want it to load the next time they start a new session.

    TIA and regards...
    Walt...


    function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {
    begin = document.cookie.indexOf(NameOfCookie+"=");
    if (begin != -1) {
    begin += NameOfCookie.length+1;
    end = document.cookie.indexOf(";", begin);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(begin, end));
    }
    }
    return null;
    }

    function setCookie(NameOfCookie, value, expiredays) {
    var ExpireDate = new Date ();
    ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

    document.cookie = NameOfCookie + "=" + escape(value) +
    ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
    }

    function delCookie (NameOfCookie) {
    if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
    }

    function DoTheCookieStuff()
    {
    visited=getCookie('visited');
    if (visited==null)
    {
    setCookie('visited','yes',365)
    MyWindow=window.open('http://www.c-spotco.com/weather_page.htm','MyWindow','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollb ars=yes,resizable=yes,width=640,height=480,left=1,top=1');
    }
    }

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    function setCookie(NameOfCookie, value, expiredays) {
    var ExpireDate = new Date ();
    ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));


    document.cookie = NameOfCookie + "=" + escape(value) +
    ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString())
    ;
    }

    try getting rid of the parts in bold. that should do it, but i'm tired, and didn't take a real thorough look.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you joh6nn.

    I did as you suggested but still now joy.

    I also deleted this line:
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";

    also with no luck. Have you another suggestion?
    I'll keep trying too....

    Regards...

  • #4
    jtr
    jtr is offline
    New Coder
    Join Date
    Jun 2002
    Location
    Northern California
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not sure if this helps

    Take a look here:
    http://wsabstract.com/popwin/index.shtml

    Step 3 has a once only per browser session.

  • #5
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thank you jtr, just right!!!

    Regards....


  •  

    Posting Permissions

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