安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
persisted()
方法在
StorageManager
interface returns a
Promise
that resolves to
true
if box mode is persistent for your site's storage.
navigator.storage.persisted().then(function(persistent) { ... })
None.
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.");
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
存储
The definition of 'persisted' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
persisted
|
Chrome
52
|
Edge ≤79 | Firefox 55 | IE ? | Opera Yes | Safari ? |
WebView Android
52
|
Chrome Android
52
|
Firefox Android 55 | Opera Android Yes | Safari iOS ? |
Samsung Internet Android
6.0
|
完整支持
兼容性未知
使用非标名称。
StorageManager
estimate()
persist()
persisted()