StorageArea.setAccessLevel()
Sets the access level for the storage area.
This method is only supported for the storage.session
StorageArea.
Unlike other storage areas, storage.session
is only available to privileged (trusted) extension contexts. This setAccessLevel
method is used to expose the session storage area to content scripts too. By default, all other storage areas are exposed to all extension contexts, including content scripts.
This is an asynchronous function that returns a Promise
.
Syntax
await browser.storage.<storageType>.setAccessLevel(
accessLevel // string
)
<storageType>
can be the storage.session
storage type.
Parameters
accessLevel
-
String
. The access level of the storage area. Possible values areTRUSTED_CONTEXTS
orTRUSTED_AND_UNTRUSTED_CONTEXTS
.
Return value
A Promise
that is fulfilled with no arguments if the operation succeeded. If the operation failed, the promise is rejected with an error message.
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.