storage.session
Represents thesession
storage area. Items insession
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 throughstorage.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 thebrowser 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
Thesession
object implements the methods defined on thestorage.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
Thesession
object implements the events defined on thestorage.StorageArea
type:
storage.session.onChanged
Fires when one or more items in the storage area change.
Example extensions
Browser compatibility
Note:This API is based on Chromium'schrome.storage
API. This documentation is derived fromstorage.json
in the Chromium code.