[whatwg] HTML Cookie API

Darin Fisher darin at chromium.org
Wed Feb 24 20:49:21 PST 2010


On Wed, Feb 24, 2010 at 6:08 PM, Adam Barth <w3c at adambarth.com> wrote:

> On Wed, Feb 24, 2010 at 5:00 PM, Nicholas Zakas <nzakas at yahoo-inc.com>
> wrote:
> > Even though there can be multiple cookies with the same name on a single
> document, this most frequently occurs due to error rather than intention.
> I've never received a YUI bug report about this occurrence though I have
> considered returning an array of values instead of just the first value in
> this case. I might just go do that now. :)
> >
> > My initial comment still remains: retrieving the value of a single named
> cookie seems to be a much more common use case than retrieving all cookies.
> You can choose to solve the duplicate cookie name issue in a number of ways,
> but not providing a way to access a cookie by name seems like a flaw in this
> design.
>
> Done.  I've made the API return the first cookie that matches the
> specified name.  If a web developer wants to get all the cookies, I've
> added a getAllCookies() API.
>
> Adam
>


Some other random comments:

1- Perhaps deleteCookie should also take an optional error callback.

2- Is it possible for setCookie to be used to set a http-only cookie?  That
could be an interesting use case.

-Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100224/abf84734/attachment-0002.htm>


More information about the whatwg mailing list