Use the browser.storage API to store, retrieve, and track changes to user data.

Permissions: storage

StorageArea
StorageAreaSync
StorageChange
local
managed
onChanged
session
sync

Items in the local storage area are local to each machine.

managed: StorageArea

Items in the managed storage area are set by administrators or native applications, and are read-only for the extension; trying to modify this namespace results in an error.

onChanged: WebExtEvent<
    (changes: { [key: string]: StorageChange }, areaName: string) => void,
>

Fired when one or more items change.

Object mapping each key that changed to its corresponding storage.StorageChange for that item.

The name of the storage area ("sync", "local" or "managed") the changes are for.

session: StorageArea

Items in the session storage area are kept in memory, and only until the either browser or extension is closed or reloaded.

Not allowed in: Content scripts

Items in the sync storage area are synced by the browser.