A storage.StorageArea
object that represents the managed
storage area. Items in managed
storage are set by the domain administrator or other native applications installed on user's computer, and are read-only for the extension. Trying to modify this storage area results in an error.
The procedure for provisioning managed storage is different for different browsers. For Chrome instructions, see the "Manifest for storage areas" article.
For Firefox, you need to create a JSON manifest file in a specific format, in a specific location. For the details of manifest syntax and location, see Native manifests.
Here's an example manifest:
{ "name": "[email protected]", "description": "ignored", "type": "storage", "data": { "color": "management thinks it should be blue!" } }
Given this manifest, the "[email protected]" extension could access the data using code like this:
var storageItem = browser.storage.managed.get('color'); storageItem.then((res) => { console.log(`Managed color is: ${res.color}`); });
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
managed |
Yes |
79 |
57
["Platform-specific storage backends, such as Windows registry keys, are not supported.", "Enforcement of extension-provided storage schemas is not supported.", "The
onChanged event is not supported."] |
? |
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–2021 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/managed