Cookies are ... designed to appear and disappear according to the
path and domain of the *currently viewed* HTML document.
and on page 203, under "Cookie value won't change":
[You can't see the new cookie value ...] You are trying to set a
cookie that isn't accessible from the current document's URL. Check
the path and domain attributes you are supplying.
Also, on page 183, the author notes that the document.cookie property is "unlike other JavaScript object properties [because] ... If you set the cookie property, its new value won't always match what you set it to."
=S
Luc Foisy wrote:
Does not calling document.cookie= create a cookie in my cookies folder? If it does, would it not still create the cookie but have a path value to whatever I set it at?
-----Original Message-----____________________________________________________
From: Spencer W. Thomas [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 14, 2003 11:13 AM
To: JDJList
Subject: [jdjlist] Re: JavaScript and cookies
I think that the path value may be relevant. Because the browser may show you the cookie only if the path "matches" the current URL. Try setting it to "/" and see if it helps.
Luc Foisy wrote:
The server does not process the cookie at all. The browsweris doing all the work with the cookie ( at least that was my intention)
I mentioned it was using tomcat and jsp incase there wassome weird stuff that I had to take into consideration.
I set that path to 172.16.0.222 because I was gettingdesperate and couldn't figure out why my cookie wasn't writing.
I have no problems with the cookie functions I have, (otherthan the load and save methods) the cookie funtions are in use on another non jsp/tomcat page and work just fine.
The cookies are not even saving, so at this point theloading is irrelevant and maybe the path is completely irrelevant knowing that...
Tomcat in no way confuses things does it?cookie will be
From: Spencer W. Thomas [mailto:[EMAIL PROTECTED]]
Let me see if I've got this straight. The JavaScript is trying to create the cookie *in the browser.* The server has nothing to do with it (except to read the cookie contents, presumably). If you are setting cookies in the server, it has to happen before any HTML is output by the jsp.
The only thing that jumps out at me below is your "path" value. "Path" is not a hostname or IP address, but is a URL path-prefix *within* the host. I typically use "path=/", so that the cookie will be sent along with a request for any URL in the domain to which the
____________________________________________________sent. If you want to limit the cookie to a particular domain you should set the domain attribute, not the path attribute.____________________________________________________
See http://www.csc.flint.umich.edu/~hickslm/392/JavaScript/jumping
JS/cookies/BillDortchSripts.htm for some useful cookie handling functions.
=Spencer
Luc Foisy wrote:
Now that we established that JavaScript != Java, i thoughtI'd come ask a JavaScript question here, but really for lack of knowing any better place to go.
Running under tomcat with jsp pages, trying to createcookies, but they dont even seem to be made. I was wondering if anyone could point out something I am missing here.
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________ To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying ____________________________________________________
