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

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

From: Tim Hutt <tdhutt@gmail.com>
Date: Thu, 4 Feb 2010 20:56:02 +0000
Message-ID: <c120886e1002041256sfe1f82eu91fa2cd9ac1438b7@mail.gmail.com>
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."
Received on Thursday, 4 February 2010 12:56:02 UTC

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