SpecLibs!

Thank you for contributing to W3C's web storage specification. You can read the current editor's draft below.

Abstract

This specification defines an API for persistent data storage of data in Web clients.

Introduction

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.

The second is designed for a storage that spans multiple windows, and lasts beyond the current session. Again, cookies do not handle this case well, because they are transmitted with every request.

The API

Each storage object provides access to a list of key/value pairs. A key/value pair is sometimes called: item. Any string is a valid key. Values can be any data type supported by the structured clone algorithm.

The getItem(key) method must return a structured clone of the current value associated with the given key.

The setItem(key, value) method must first create a structured clone of the given value. If constructing the stuctured clone would involve constructing a new ImageData object, then throw a NOT_SUPPORTED_ERR exception instead.

The storage event is fired when a storage area changes. Since the storage event can execute in multiple browsing contexts simultaneously, it is not thread-safe and should not be triggered other than other than in a way that is predictable by script.