storage.session

Represents the session storage area. Items in session storage are stored in memory for the duration of the browser session and are not persisted to disk. By default, it's not exposed to content scripts, but this behavior can be changed through storage.session.setAccessLevel().

The amount of data that an extension can store in the session storage area is limited to 10 MB, unless stated otherwise in the browser compatibility table.

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

Properties

storage.session.QUOTA_BYTES

The maximum amount of data (in bytes) that can be stored in session storage.

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.setAccessLevel()

Sets the access level for the storage area.

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.