Re: [whatwg] Suggestion: API for accessing cookies (document.cookies)

2008-02-08 Thread Ian Hickson
On Fri, 28 Dec 2007, Christian Schmidt wrote:

 In order to read, write and delete cookies from script most people use 
 their own utility functions like the ones shown at 
 http://www.w3schools.com/js/js_cookies.asp

Indeed. I think though that at this point this is well enough understood 
that it's not really worth changing the API -- people will have to support 
the old one for years anyway.


 It would be useful if cookies could be read, written and deleted through 
 a more abstract API, e.g. by an HTMLCollection-like interface stored in 
 document.cookies. This would allow something like this:
 
 if (document.cookies.myCookie) {
   alert(document.cookies.myCookie.value)
 
   document.cookies.remove('myCookie');
   // or alternatively
   document.cookies.myCookie.remove();
 
   document.cookies.add('myCookie2', 'myVal', '/', 'example.org');
 }
 
 In particular the remove() method would be useful, because today neither 
 the client-side nor the server-side can determine the path and domain 
 parameters necessary to delete a given cookie unless they know how it 
 was originally set.

 The API could give access to the values only or possibly also to the 
 other properties (expiry, path etc.) that are currenly not accessible 
 from neither client-side nor server-side.

Well, the DOM storage API and the SQL APIs provide a better API than 
cookies, but of course that data isn't sent over the network. A library 
could be made to interface them, though.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Suggestion: API for accessing cookies (document.cookies)

2008-01-03 Thread Christian Schmidt

Anne van Kesteren wrote :

I think that globalStorage and sessionStorage obviate the need for cookies.
AFAICS globalStorage and sessionStorage are designed for client-side use 
only.


I think cookies will still be useful to some extent for data that is 
accessed from both client-side and server-side.



Christian



Re: [whatwg] Suggestion: API for accessing cookies (document.cookies)

2008-01-03 Thread Jonas Sicking

Christian Schmidt wrote:

Anne van Kesteren wrote:
I think that globalStorage and sessionStorage obviate the need for 
cookies.
AFAICS globalStorage and sessionStorage are designed for client-side use 
only.


I think cookies will still be useful to some extent for data that is 
accessed from both client-side and server-side.


Agreed. However I don't think we can use the .cookies name for this API 
as that already has a defined meaning.


/ Jonas


Re: [whatwg] Suggestion: API for accessing cookies (document.cookies)

2007-12-28 Thread Anne van Kesteren
On Fri, 28 Dec 2007 18:13:38 +0100, Christian Schmidt [EMAIL PROTECTED]  
wrote:

What do you think of this?


I think that globalStorage and sessionStorage obviate the need for cookies.


--
Anne van Kesteren
http://annevankesteren.nl/
http://www.opera.com/