W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2009

[whatwg] localStorage behavior when cookies mode is session-only

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 3 Jun 2009 20:15:30 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0906032014150.1648@hixie.dreamhostps.com>
On Thu, 9 Apr 2009, Honza Bambas wrote:
>
> In the W3C spec for localStorage 
> http://dev.w3.org/html5/webstorage/#the-localstorage-attribute is said 
> to present it (the persistent storage) the same way as cookies.
> 
> There were suggestion to throw DOM_QUOTA_ERROR exception when storing to 
> localStorage in case when cookies are in a session-only mode for a 
> host/page. It makes sense from several reasons. This way web apps may 
> decide or inform user about situation that the page cannot store to 
> localStorage while there is no way for the page to figure out that 
> cookies mode is session-only and web app still may freely read from the 
> storage.
> 
> My suggestion is then:
> - allow a page to obtain valid localStorage object
> - allow read from it
> - throw DOM_QUOTA_ERROR when storing to it
> 
> But I don't know what to do in case of call to clear() and removeItem() 
> methods. It would exposes the cookie behavior again when it 
> fails/throws.

Wouldn't it be best for the UA to store the data as normal, and report to 
the user in some informative messages somewhere in the interface that data 
has been stored but will be discarded? (The UA could even offer to save 
it, in fact.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 3 June 2009 13:15:30 UTC

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