StorageManager

翻译不完整。 请帮助我们翻译这篇文章!

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

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

Storage APIStorageManager接口提供了用于管理数据本地存储权限和估算可用存储空间的接口。 您可以使用navigator.storageWorkerNavigator.storage对此接口进行引用。

方法

StorageManager.estimate() Secure context
返回一个StorageEstimate对象,此对象包含为你的域名预留的存储空间总大小和你已经使用的存储空间大小。
StorageManager.persist() Secure context
如果您的user agent能够将你域名下的数据持久保存,那么将返回一个状态为resolve的Promise
StorageManager.persisted() Secure context
如果您的站点已经被授予可使用数据本地存储的权限,则返回一个状态为resolve的Promise

规范

Specification Status Comment
Storage
StorageManger
Living Standard Initial definition.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
StorageManagerChrome Full support 48Edge Full support ≤79Firefox Full support 57
Full support 57
No support 51 — 57
Notes Disabled
Notes See bug 1304966 and bug 1399038.
Disabled From version 51 until version 57 (exclusive): this feature is behind the dom.storageManager.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE ? Opera Full support YesSafari ? WebView Android Full support 48Chrome Android Full support 48Firefox Android Full support 51
Notes Disabled
Full support 51
Notes Disabled
Notes See bug 1304966 and bug 1399038.
Disabled From version 51: this feature is behind the dom.storageManager.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 5.0
estimateChrome Full support 52Edge Full support ≤79Firefox Full support 51IE ? Opera Full support YesSafari ? WebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 51Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 6.0
persistChrome Full support 52
Full support 52
No support 48 — 52
Alternate Name
Alternate Name Uses the non-standard name: requestPersistent
Edge Full support ≤79Firefox Full support 55IE ? Opera Full support YesSafari ? WebView Android Full support 52
Full support 52
No support 48 — 52
Alternate Name
Alternate Name Uses the non-standard name: requestPersistent
Chrome Android Full support 52
Full support 52
No support 48 — 52
Alternate Name
Alternate Name Uses the non-standard name: requestPersistent
Firefox Android Full support 55Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 6.0
Full support 6.0
No support 5.0 — 6.0
Alternate Name
Alternate Name Uses the non-standard name: requestPersistent
persistedChrome Full support 52
Full support 52
No support 48 — 52
Alternate Name
Alternate Name Uses the non-standard name: persistentPermission
Edge Full support ≤79Firefox Full support 55IE ? Opera Full support YesSafari ? WebView Android Full support 52
Full support 52
No support 48 — 52
Alternate Name
Alternate Name Uses the non-standard name: persistentPermission
Chrome Android Full support 52
Full support 52
No support 48 — 52
Alternate Name
Alternate Name Uses the non-standard name: persistentPermission
Firefox Android Full support 55Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 6.0
Full support 6.0
No support 5.0 — 6.0
Alternate Name
Alternate Name Uses the non-standard name: persistentPermission

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.