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
)
<storageType> can be the storage.session storage type.
Parameters
-
accessLevel
-
String. The access level of the storage area. Possible values are TRUSTED_CONTEXTS or TRUSTED_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
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
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 |
? |