storage.session

Represents the session storage area. Items in session storage are stored in memory and are not persisted to disk.

The browser may restrict the amount of data that an extension can store in the session storage area. For example, in Chrome, an extension is limited to storing 1MB of data in this storage area.

When the browser stops, all session storage is cleared. When the extension is uninstalled, its associated session storage is cleared.

Methods

The session object implements the methods defined on the storage.StorageArea type:

storage.session.get()

Retrieves one or more items from the storage area.

storage.session.getBytesInUse()

Gets the amount of storage space (in bytes) used for one or more items in the storage area.

storage.session.set()

Stores one or more items in the storage area. If the item exists, its value is updated.

storage.session.remove()

Removes one or more items from the storage area.

storage.session.clear()

Removes all items from the storage area.

Events

The session object implements the events defined on the storage.StorageArea type:

storage.session.onChanged

Fires when one or more items in the storage area change.

Browser compatibility

BCD tables only load in the browser

Note: This API is based on Chromium's chrome.storage API. This documentation is derived from storage.json in the Chromium code.