StorageManager.persisted()
**persisted()
**方法是StorageManager
的一个接口,如果盒存储模式(box mode)的值为“persistent”则返回一个 resolved 状态值为true
的Promise
。
语法
navigator.storage.persisted().then(function(persistent) { ... })
参数
无
返回值
示例
js
if (navigator.storage && navigator.storage.persist)
navigator.storage.persisted().then(function (persistent) {
if (persistent)
console.log("Storage will not be cleared except by explicit user action");
else
console.log("Storage may be cleared by the UA under storage pressure.");
});
规范
Specification |
---|
Storage # dom-storagemanager-persisted |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
persisted |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.