Results 1 to 4 of 4

Thread: delete cookie then close

  1. #1
    Join Date
    Jan 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default delete cookie then close

    Hi there. I'm trying to write a script that will delete a cookie called 'access' then close the popup window. Having a bit of trouble... this is what I've got so far:

    Code:
    <script>
    ByeThen() {
    eraseCookie('access')
    function eraseCookie(name)
    {
            createCookie(name,"",-1);
    }
            window.close()
    }
    </script>
    Cheers
    Last edited by monkeyboy; 01-27-2006 at 11:27 AM.

  2. #2
    Join Date
    Jan 2006
    Location
    Sweden
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    why not just do document.cookie=""?
    That would clear the whole cookie file I think.

  3. #3
    Join Date
    Jan 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks TwoD... thing is I'm having trouble writing it into a script that I can call from a text 'close' link. Where do I name the cookie I want to delete? Cheers, P.
    Last edited by monkeyboy; 01-28-2006 at 11:16 AM.

  4. #4
    Join Date
    Jan 2006
    Location
    Sweden
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Cookies have no names, and you can only have one per page.
    You can set name/value pairs in them and then separate them using cookieString.split("=").
    More about cookies here:
    http://www.quirksmode.org
    Go to JavaScript->Miscellaneous scripts->Cookies

Bookmarks

Posting Permissions

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