[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Further questions about cookies

On  Tue, 19 Mar 1996 09:57:14  Jim Kissel wrote:

> One further question on the subject of cookies.  Is the
> cookie associated with the document which currently has the
> focus, or is the cookie associated with the Javascript
> virtual machine.
> I ask this question because the Netscape documentation it
> open to interpertation.  First the cookie is 
> document.cookie
> but the documentation goes on to say that servers should
> only expect the client to store 300 cookies and a max of
> 4k of data.
> Tests I have done in regards to this seem to indicate that
> although all the other document.xxx items are unique to each
> individual document, the cookie is generic to the Javascript
> virtual machine.

document.cookie accesses the relative contents of the 'cookies.txt'
file for the current path and domain. The cookies.txt file may contain
cookies from various path / domain combinations and can be quite large
(about 1.2 meg total). However, only cookies that meet the path /
domain requirements can be accessed, updated, or expired through the
use of document.cookie.

As long as the 'expires' attribute is not a date in the past, the
cookie will persist and be written / retained in the cookies.txt file
when Navigator is exited (assuming a graceful exit).

I have a cookies demo and functions complete with parsing to allow
multiple data items to be stored / retrieved from a single cookie at:


Select the 'Cookie and Banners' link.

Note: The help file is a bit ragged at present. I would appreciate
comments and criticism so I can improve on its contents.

For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/