-
Notifications
You must be signed in to change notification settings - Fork 18
Thoughts on sessionStorage #22
Comments
Somewhat similar to #21, the issue here is again that:
One point worth discussing though is that I'm not sure how to build a SessionStorage replacement yourself. I.e., when do you call |
I agree that sessionStorage is likely seeing little use now, but this might be due to a lack of knowledge about the implications or alternatives to localStorage. With stricter privacy laws such as the GDPR coming into play and requiring more careful handling of data, this might change soon.
The data would ideally be cleared at the end of a session rather than when a new one begins, in order to protect against someone else who has access to the machine. I recognise that this might not be possible without new low-level capabilities, though. Alternatively, a spec like https://github.com/w3c/webappsec-clear-site-data might be able to provide a mechanism which can clear data at the end of a session (or just keeps it in memory at all times), in which case there would be no need for the storage API itself to cover it. |
So, this would probably need whatwg/storage#11 (or w3c/IndexedDB#205, with a session-based rather than time-based option) to be resolved, for this to be possible to implement as a layered API. I still think it would be nice to keep in mind a potential expansion of the API which could allow for this in the future, by passing an options object to the |
Wikipedia's abstraction around Web Storage does support both sessionStorage and localStorage. https://doc.wikimedia.org/mediawiki-core/REL1_30/js/#!/api/mw.storage Source code: https://github.com/wikimedia/mediawiki/blob/1.30.0/resources/src/mediawiki/mediawiki.storage.js |
Just wanted to drop an idea here that came to me in another discussion about sessionStorage and a possible analog within
|
This proposal only covers async localStorage at the moment, leaving its less common sibling sessionStorage unmentioned. Nevertheless I occasionally see those who recommend using it for handling temporary data.
I'm curious where you stand on this. Could you see it being added as part of this proposal later on? Do you think it should be a separate layered API? Or has the use case for sessionStorage proven small enough that it may not be justified at all?
The text was updated successfully, but these errors were encountered: