google-chrome - Chrome StorageManager API 报告配额远大于预期

标签 google-chrome storage indexeddb quota web-storage

我想获得可以在indexedDB中存储的用于存储许多大型二进制文件的上限,而 StorageManager.estimate() 报告的值比我的实际可用磁盘空间大得多。

enter image description here

enter image description here

然后我发现这个 answer 提供了检查 chrome://quota-internals/ 的提示,该页面神秘地显示了正确的统计数据。 enter image description here

这个 chrome developer blog 说明了估算的准确性,但没有多大帮助。

最佳答案

Storage API spec说:

The storage quota of a storage shelf is an implementation-defined conservative estimate of the total amount of bytes it can hold. This amount should be less than the total storage space on the device. It must not be a function of the available storage space on the device.

返回的值并非基于设备上的实际可用空间,而是小于设备总容量的量,并且基于与用户参与度相关的多个因素。其背后的原因是:

Directly or indirectly revealing available storage space can lead to fingerprinting and leaking information outside the scope of the origin involved.

This article指出 Chrome 允许源最多使用总磁盘空间的 60%,这与我在查询配额时看到的结果一致。无法获得实际的可用空间。目前,Chrome 将始终将配额报告为总磁盘空间的 %60,除非在某些情况下(例如在隐身模式下浏览时)。其他浏览器的行为可能有所不同,因为具体如何实现此功能由浏览器供应商决定。

关于google-chrome - Chrome StorageManager API 报告配额远大于预期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72405318/

相关文章:

javascript - 1925 年之前的 JavaScript 日期中的错误分钟和秒

javascript - 如何通过 Chrome 扩展程序保存网页的完整状态?

html - 存储限制(在 IndexedDB 或 localStorage 上)是否适用于在计算机外运行的本地应用程序?

html - 在 IndexedDB 中,有没有办法进行排序复合查询?

javascript - Chrome 扩展程序的 chrome.tabs.onCreated 和 executescript 不起作用

java - 将 GIF 文件保存到存储器

javascript - jaydata 无法在相关数据存储中工作

c# - 我的扩展方法可以变得更好吗? BlockBlobClient GetBlockById dotnet

dart - 如何使用 Dart 在 IndexedDB 中使用复合键创建对象存储

google-chrome - 如何在 Ubuntu 中向 firefox 和 chrome 添加新的 MIME/协议(protocol)处理程序?