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 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cookie help - i close browser and returns null

    Ok, so I have my cookie script, and it can set and retrieve cookies just fine. But if I close my browser and reopen the page, the cookie returns null. To be sure it wasn't a coding mistake that I made, I went to a website where they also had a cookie example. The same thing happened. Can any one post some code that could solve this wierd problem? (I tested on both IE and firefox just to make sure).

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,603
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Did you set an expiry date? Without an expiry date the cookie will be automatically deleted when the browser is closed.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I have an expiry date set. The page I used for my second test that *wasn't* part of my code is here
    On this page they show their code, along with links at the very bottom that set the cookie and get the cookie. I still have the same problem of it returning null. I do have cookies enabled, if there are any other cookie options I can set in IE or firefox tell me please, but I don't understand.


  •  

    Posting Permissions

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