安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
StorageEstimate
dictionary's
usage
property is a conservative approximation of how much storage is allotted to the origin or Web app that called
StorageManager.estimate()
; there may be more space available, but there will not be less. The value is an estimate because the
用户代理
may use compression, duplication prevention techniques, and other methods to improve storage efficiency.
usage = StorageEstimate.usage;
A numeric value specifying an approximation of the total amount of storage space available for use by the application.
In this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user.
<label> You’re currently using about <output id="percent"> </output>% of your available storage. </label>
navigator.storage.estimate().then(function(estimate) {
document.getElementById("percent").value =
(estimate.usage / estimate.quota * 100).toFixed(2);
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
存储
The definition of 'usage' in that specification. |
实时标准 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
usage
|
Chrome 52 | Edge ≤79 | Firefox 51 | IE ? | Opera 42 | Safari ? | WebView Android 52 | Chrome Android 52 | Firefox Android 51 | Opera Android 42 | Safari iOS ? | Samsung Internet Android 6.0 |
完整支持
兼容性未知
StorageEstimate