StorageManager

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The StorageManager interface of the the Storage API provides an interface for managing persistance permissions and estimating available storage. You can get a reference to this interface using either navigator.storage or WorkerNavigator.storage.

Methods

StorageManager.estimate() Secure context
Returns a StorageEstimate object containing usage and quota numbers for your origin.
StorageManager.persist() Secure context
Returns a Promise that resolves to true if the user agent is able to persist your site's storage.
StorageManager.persisted() Secure context
Returns a Promise that resolves to true if persistence has already been granted for your site's storage.
Specification Status Comment
Storage
The definition of 'StorageManger' in that specification.
Living Standard Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Microsoft Edge Opera Safari (WebKit)
Basic support 55.0 51 (51)[1] ? ? 42 ?
estimate() 61.0 51 (51)[1]        
persist() and persisted() 55.0 55 (55)[2]        

 

Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 55.0 51.0 (51)[1] ? 42 ? 55.0
estimate()   61.0         61.0
persist() and persisted()   55.0         55.0

[1] Firefox 51 introduced NavigatorStorage, navigator.storage, and the StorageManager.estimate() method. These are enabled by default in nightly builds but disabled by default in all other builds. You can enable these features by setting the preference dom.storageManager.enabled to true.
[2] Firefox 55 introduced StorageManager.persist() and StorageManager.persisted() methods. Users can also manage persistent-storage data in Preferences "Privacy and  Security" -> "Site data".  These are enabled by default in nightly builds but disabled by default in all other builds. You can enable these features by setting the preference dom.storageManager.enabled and browser.storageManager.enabled to true.
 

文档标签和贡献者