[whatwg] Window id - a proposal to leverage session usage in web application

Tim Hutt tdhutt at gmail.com
Thu Feb 4 12:56:02 PST 2010


On 4 February 2010 20:49, Sebastian Hennebrueder <usenet at laliluna.de> wrote:
> What is the idea about?

I think "Web Storage" does what you want and is already implemented
(apparently even in IE). The description from the spec:

"This specification introduces two related mechanisms, similar to HTTP
session cookies, for storing structured data on the client side.

The first is designed for scenarios where the user is carrying out a
single transaction, but could be carrying out multiple transactions in
different windows at the same time.

Cookies don't really handle this case well. For example, a user could
be buying plane tickets in two different windows, using the same site.
If the site used cookies to keep track of which ticket the user was
buying, then as the user clicked from page to page in both windows,
the ticket currently being purchased would "leak" from one window to
the other, potentially causing the user to buy two tickets for the
same flight without really noticing.

To address this, this specification introduces the sessionStorage IDL
attribute. Sites can add data to the session storage, and it will be
accessible to any page from the same site opened in that window.

For example, a page could have a checkbox that the user ticks to
indicate that he wants insurance:

<label>
 <input type="checkbox" onchange="sessionStorage.insurance = checked">
 I want insurance on this trip.
</label>
A later page could then check, from script, whether the user had
checked the checkbox or not:

if (sessionStorage.insurance) { ... }
If the user had multiple windows opened on the site, each one would
have its own individual copy of the session storage object."



More information about the whatwg mailing list