storage.managed

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 the user's computer and are read-only for the extension. Trying to modify this storage area results in an error.

Provisioning managed storage

The procedure for provisioning managed storage varies between browsers. For Chrome instructions, see the "Manifest for storage areas" article.

For Firefox, you need to create a JSON manifest (native manifest) file in a specific format and location or use the 3rdparty enterprise policy.

Here's an example native manifest:

json
{
  "name": "favourite-colour-examples@mozilla.org",
  "description": "ignored",
  "type": "storage",
  "data": {
    "colour": "management thinks it should be blue!"
  }
}

Given this manifest, the favourite-colour extension could access the data using code like this:

js
let storageItem = browser.storage.managed.get("colour");
storageItem.then((res) => {
  console.log(`Managed colour is: ${res.colour}`);
});

Methods

The managed object implements the methods defined on the storage.StorageArea type:

storage.managed.get()

Retrieves one or more items from the storage area.

storage.managed.getBytesInUse()

Gets the amount of storage space (in bytes) used for one or more items in the storage area.

Events

The managed object implements the events defined on the storage.StorageArea type:

storage.managed.onChanged

Fires when one or more items in the storage area change.

Example extensions

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.