StorageArea is an object representing a storage area.
On this page
storage.StorageArea
Type
Values of this type are objects.
Methods
-
storage.StorageArea.get()
-
Retrieves one or more items from the storage area.
-
storage.StorageArea.getBytesInUse()
-
Gets the amount of storage space (in bytes) used one or more items being stored in the storage area.
-
storage.StorageArea.set()
-
Stores one or more items in the storage area. If an item already exists, its value will be updated.
-
storage.StorageArea.setAccessLevel()
-
Sets the access level for the storage area.
-
storage.StorageArea.remove()
-
Removes one or more items from the storage area.
-
storage.StorageArea.clear()
-
Removes all items from the storage area.
Events
-
storage.StorageArea.onChanged
-
Fires when one or more items in the storage area change.
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
StorageArea |
Yes | 14 | 45 | ? | Yes | 14 | ? | ? | 48 | ? | 15 | ? |
clear |
Yes | 14 | 45 | ? | 33 | 14 | ? | ? | 48 | ? | 15 | ? |
get |
Yes | 14 | 45 | ? | 33 | 14 | ? | ? | 48 | ? | 15 | ? |
getBytesInUse |
Yes | 14 |
78Only supported by thesync storage area.
|
? | 33 | 14 | ? | ? | No | ? | 15 | ? |
onChanged |
73 | Yes | 101 | ? | Yes | 14 | ? | ? | 101 | ? | 15 | ? |
remove |
Yes | 14 | 45 | ? | 33 | 14 | ? | ? | 48 | ? | 15 | ? |
set |
Yes |
14storage is limited to 1MB per value. |
45 | ? | 33 | 14 | ? | ? | 48 | ? | 15 | ? |
setAccessLevel |
96Only supported for the session storage area. |
96Only supported for the session storage area. |
No | ? |
82Only supported for the session storage area. |
No | ? | ? | No | ? | No | ? |
Note: This API is based on Chromium's chrome.storage
API. This documentation is derived from storage.json
in the Chromium code.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/StorageArea