Der Rest dieses Vergleichs wird geladen.

Untitled diff

Erstellt Diff läuft nie ab
42 Entfernungen
335 Zeilen
43 Hinzufügungen
335 Zeilen
Web Storage
Web Storage (Second Edition)
Editor's Draft 14 May 2014
W3C Working Draft TBC


This Version:
TBC
Latest Published Version:
Latest Published Version:
http://www.w3.org/TR/webstorage/
http://www.w3.org/TR/webstorage/
Latest Editor's Draft:
Latest Editor's Draft:
http://dev.w3.org/html5/webstorage/
http://dev.w3.org/html5/webstorage/
Previous Versions:
Previous Versions:
http://www.w3.org/TR/2013/REC-webstorage-20130730/
http://www.w3.org/TR/2013/PR-webstorage-20130409/
http://www.w3.org/TR/2011/CR-webstorage-20111208/
http://www.w3.org/TR/2011/WD-webstorage-20111025/
http://www.w3.org/TR/2011/WD-webstorage-20110901/
http://www.w3.org/TR/2011/WD-webstorage-20110208/
http://www.w3.org/TR/2011/WD-webstorage-20110208/
http://www.w3.org/TR/2009/WD-webstorage-20091222/
http://www.w3.org/TR/2009/WD-webstorage-20091222/
http://www.w3.org/TR/2009/WD-webstorage-20091029/
http://www.w3.org/TR/2009/WD-webstorage-20091029/
http://www.w3.org/TR/2009/WD-webstorage-20090423/
http://www.w3.org/TR/2009/WD-webstorage-20090423/
Editor:
Editor:
Ian Hickson, Google, Inc.
Ian Hickson, Google, Inc.
Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
Please refer to the errata for this document, which may include some normative corrections.
See also translations.
Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
The bulk of the text of this specification is also available in the WHATWG Web Applications 1.0 specification, under a license that permits reuse of the specification text.
The bulk of the text of this specification is also available in the WHATWG Web Applications 1.0 specification, under a license that permits reuse of the specification text.
Abstract
Abstract


This specification defines an API for persistent data storage of key-value pair data in Web clients.
This specification defines an API for persistent data storage of key-value pair data in Web clients.


Status of This document
Status of This document


This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the most recently formally published revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

If you wish to make comments regarding this document, you can enter feedback using this form:

Feedback Comments
Please enter your feedback, carefully indicating the title of the section for which you are submitting feedback, quoting the text that's wrong today if appropriate. If you're suggesting a new feature, it's really important to say what the problem you're trying to solve is. That's more important than the solution, in fact.



Please don't use section numbers as these tend to change rapidly and make your feedback harder to understand.

(Note: Your IP address and user agent will be publicly recorded for spam prevention purposes.)
You can also e-mail feedback to public-webapps@w3.org (subscribe, archives), or whatwg@whatwg.org (subscribe, archives). All feedback is welcome.

Implementors should be aware that this specification is not stable. Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the aforementioned mailing lists and take part in the discussions.


The latest stable version of the editor's draft of this specification is always available on the W3C CVS server and in the WHATWG Subversion repository. The latest editor's working copy (which may contain unfinished text in the process of being prepared) contains the latest draft text of this specification (amongst others). For more details, please see the WHATWG FAQ.
The W3C Web Applications Working Group created a Test Suite for this spec and the Implementation Report for this specification.


Notifications of changes to this specification are sent along with notifications of changes to related specifications using the following mechanisms:
The following changes were made to this specification after Web Storage was published as a W3C Recommendation on 30 July 2013:


E-mail notifications of changes
The IDL of the Storage interface and the StorageEvent was updated. The getter of the Storage interface and the key of the StorageEvent are Nullable in this document;
Commit-Watchers mailing list (complete source diffs): http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org
The security section in LocalStorage was removed. The original version claimed that user agents must throw a SecurityError whenever any of the members of a Storage object originally returned by the localStorage attribute are accessed by scripts whose effective script origin is not the same as the origin of the Document of the Window object on which the localStorage attribute was accessed.
Browsable version-control record of all changes:
If you wish to submit bugs regarding this document in a manner that is tracked by the W3C, please submit them via using our public bug database. You can also e-mail feedback to public-webapps@w3.org (subscribe, archives), or whatwg@whatwg.org (subscribe, archives). All feedback is welcome.
CVSWeb interface with side-by-side diffs: http://dev.w3.org/cvsweb/html5/
Annotated summary with unified diffs: http://html5.org/tools/web-apps-tracker
Raw Subversion interface: svn checkout http://svn.whatwg.org/webapps/
The W3C Web Applications Working Group is the W3C working group responsible for this specification's progress along the W3C Recommendation track. This specification is the 14 May 2014 Editor's Draft.


This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.


Issues
Issues


The use of the storage mutex to avoid race conditions is currently considered by certain implementors to be too high a performance burden, to the point where allowing data corruption is considered preferable. Alternatives that do not require a user-agent-wide per-origin script lock are eagerly sought after. If reviewers have any suggestions, they are urged to send them to the addresses given in the previous section.
The use of the storage mutex to avoid race conditions is currently considered by certain implementors to be too high a performance burden, to the point where allowing data corruption is considered preferable. Alternatives that do not require a user-agent-wide per-origin script lock are eagerly sought after. If reviewers have any suggestions, they are urged to send them to the addresses given in the previous section.


More details regarding this issue are available in these e-mails (as well as numerous others):
More details regarding this issue are available in these e-mails (as well as numerous others):


http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/023059.html
https://lists.w3.org/Archives/Public/public-whatwg-archive/2009Sep/0009.html
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-December/024277.html
https://lists.w3.org/Archives/Public/public-whatwg-archive/2009Sep/0513.html
Table of Contents
Table of Contents


1 Introduction
1 Introduction
2 Conformance requirements
2 Conformance requirements
2.1 Dependencies
2.1 Dependencies
3 Terminology
3 Terminology
4 The API
4 The API
4.1 The Storage interface
4.1 The Storage interface
4.2 The sessionStorage attribute
4.2 The sessionStorage attribute
4.3 The localStorage attribute
4.3 The localStorage attribute
4.4 The storage event
4.4 The storage event
4.4.1 The StorageEvent interface
4.4.1 The StorageEvent interface
4.5 Threads
4.5 Threads
5 Disk space
5 Disk space
6 Privacy
6 Privacy
6.1 User tracking
6.1 User tracking
6.2 Sensitivity of data
6.2 Sensitivity of data
7 Security
7 Security
7.1 DNS spoofing attacks
7.1 DNS spoofing attacks
7.2 Cross-directory attacks
7.2 Cross-directory attacks
7.3 Implementation risks
7.3 Implementation risks
References
References
Acknowledgements
Acknowledgements
1 Introduction
1 Introduction


This section is non-normative.
This section is non-normative.


This specification introduces two related mechanisms, similar to HTTP session cookies, for storing name-value pairs on the client side. [COOKIES]
This specification introduces two related mechanisms, similar to HTTP session cookies, for storing name-value pairs on the client side. [COOKIES]


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.
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.
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.
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:
For example, a page could have a checkbox that the user ticks to indicate that he wants insurance:


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


if (sessionStorage.insurance) { ... }
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.
If the user had multiple windows opened on the site, each one would have its own individual copy of the session storage object.


The second storage mechanism is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.
The second storage mechanism is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.


Again, cookies do not handle this case well, because they are transmitted with every request.
Again, cookies do not handle this case well, because they are transmitted with every request.


The localStorage IDL attribute is used to access a page's local storage area.
The localStorage IDL attribute is used to access a page's local storage area.


The site at example.com can display a count of how many times the user has loaded its page by putting the following at the bottom of its page:
The site at example.com can display a count of how many times the user has loaded its page by putting the following at the bottom of its page:


<p>
<p>
You have viewed this page
You have viewed this page
<span id="count">an untold number of</span>
<span id="count">an untold number of</span>
time(s).
time(s).
</p>
</p>
<script>
<script>