mozilla
Ihre Suchergebnisse

    IndexedDB

    Dies ist eine experimentelle Technologie
    Da diese Technologie noch nicht definitiv implementiert wurde, sollte die Browser Kompatibilität beachtet werden. Es ist auch möglich, dass der Syntax in einer späteren Spezifikation noch geändert wird.

    IndexedDB is an API for client-side storage of significant amounts of structured data and for high performance searches on this data using indexes. While DOM Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.

    This page is basically the entry point for the technical description of the API objects. If you need a primer you should consult Basic Concepts About IndexedDB. For a lot more details, see Using IndexedDB.

    IndexedDB provides separate APIs for synchronous and asynchronous access. The synchronous API is intended to be used only inside of Web Workers but it isn't implemented by any browser yet. The asynchronous API works both within and without Web Workers.

    Asynchronous API

    The asynchronous API methods return without blocking the calling thread. To get asynchronous access to a database, call open() on the indexedDB attribute of a window object. This method returns an IDBRequest object (IDBOpenDBRequest); asynchronous operations communicate to the calling application by firing events on IDBRequest objects.

    Note: The indexedDB object is prefixed in older browser versions (property mozIndexedDB in Gecko < 16, webkitIndexedDB in Chrome, and msIndexedDB in IE 10).

    • IDBFactory provides access to a database. This is the interface implemented by the global object indexedDB and is therefore the entry point for the API.
    • IDBCursor iterates over object stores and indexes.
    • IDBCursorWithValue iterates over object stores and indexes and returns the cursor's current value.
    • IDBDatabase represents a connection to a database. It's the only way to get a transaction on the database.
    • IDBEnvironment provides access to a client-side database. It is implemented by window objects.
    • IDBIndex provides access to the metadata of an index.
    • IDBKeyRange defines a range of keys.
    • IDBObjectStore represents an object store.
    • IDBOpenDBRequest represents a request to open a database.
    • IDBRequest provides access to results of asynchronous requests to databases and database objects. It is what you get when you call an asynchronous method.
    • IDBTransaction represents a transaction. You create a transaction on a database, specify the scope (such as which object stores you want to access), and determine the kind of access (read only or write) that you want.
    • IDBVersionChangeEvent indicates that the version of the database has changed.

    An early version of the specification also defined these now removed interfaces. They are still documented in case you need to update previously written code:

    There is also a synchronous version of the API.  The Synchronous API has not been implemented in any browser.  It is intended for use with WebWorkers.

    Storage limits

    There isn't any limit on a single database item's size. However there may be a limit on each IndexedDB database's size. This limit (and the way the user interface will assert it) may vary from one browser to another:

    Example

    A powerful example of what IndexedDB can be utilized for on the web is the example by Marco Castelluccio, winner of the IndexedDB Mozilla DevDerby. The winning demo was eLibri, a library and eBook reader application.

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    Asynchronous API

    24.0
    11.0 webkit

    16.0 (16.0)
    4.0 (2.0) moz

    10 Not supported Not supported
    Synchronous API
    (used with WebWorkers)
    Not supported Not supported
    See Bug 701634
    Not supported Not supported Not supported
    Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
    Asynchronous API Not supported 6.0 (6.0) moz Not supported Not supported Not supported

    For another browser compatibility Matrix see also: When Can I Use IndexedDB

    There is also the possibility of using IndexedDB on browsers that support WebSQL by using the IndexedDB Polyfill.

    See also

    Schlagwörter des Dokuments und Mitwirkende

    Mitwirkende an dieser Seite: Huan
    Zuletzt aktualisiert von: Huan,