Problem with javascript and cookies

Results 1 to 2 of 2

Thread: Problem with javascript and cookies

  1. #1
    Join Date
    Dec 1969

    Default Problem with javascript and cookies

    I am trying to set a cookie by using javascript on the client side. When I set it and display the cookie after it looks fine. But if I close the browser and return the cookie is gone. Below is the code I am using.<BR><BR> expireDate = new Date<BR> expireDate.setMonth(expireDate.getMonth()+6)<BR> <BR> submitterType = ""<BR> submitterType = document.settings.submittype.value<BR> if (submitterType == "0"){<BR> alert("Please select a submitter type before continuing")<BR> }<BR> else{<BR> theNewCookie = "submitterType="+submitterType+";expires="+expireD ate.toGMTString(); <BR> document.cookie = escape(theNewCookie);<BR> alert(unescape(document.cookie))<BR> opener.history.go(0)<BR> self.close()<BR><BR>The cookie seems to be availible only for the session and is not saved. The following is the output from the alert.<BR><BR> submitterType=I;expires=Sat, 2 Nov 2002 17:54:04 UTC<BR><BR>I was told that I had to use the escape() and unescape() functions to tahe care of : and spaces in the cookie.<BR><BR>Any help rendered would be apreciated.

  2. #2
    Join Date
    Dec 1969

    Default Browser settings

    This sounds like a problem with your browser settings. It should work fine for everybody else.

Posting Permissions

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