W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] HTML Cookie API

From: Darin Fisher <darin@chromium.org>
Date: Tue, 23 Feb 2010 22:22:49 -0800
Message-ID: <bd8f24d21002232222s74a457e9xc9340e3fedbc53a8@mail.gmail.com>
On Tue, Feb 23, 2010 at 9:21 PM, Adam Barth <w3c at adambarth.com> wrote:

> On Tue, Feb 23, 2010 at 9:15 PM, Jonas Sicking <jonas at sicking.cc> wrote:
> > On Tue, Feb 23, 2010 at 8:56 PM, Adam Barth <w3c at adambarth.com> wrote:
> >> The document.cookie API is kind of terrible.  Web developers shouldn't
> >> have to parse a cookie-string or prepare a properly formated
> >> set-cookie-string.  Here's a proposal for an HTML cookie API that
> >> isn't as terrible:
> >>
> >>
> https://docs.google.com/Doc?docid=0AZpchfQ5mBrEZGQ0cDh3YzRfMTRmdHFma21kMg&hl=en
> >>
> >> I'd like to propose we include this API in a future version of HTML.
> >> As always, feedback welcome.
> >
> > I really think the API should be asynchronous, as to avoid the mess
> > that .localStorage currently is.
>
> Done.
>
> Adam
>

I have frequently seen code like this:

document.cookie = "foo=1";
if (document.cookie.indexOf("foo") == -1) return;
document.cookie = "bar=2";
if (document.cookie.indexOf("bar") == -1) return;

I presume it is not uncommon for web authors to want to know if the cookies
were set.  Maybe there should be an optional error callback on
document.setCookie?

-Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100223/7449b5fe/attachment.htm>
Received on Tuesday, 23 February 2010 22:22:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC