簡體   English   中英

如何檢測到已達到IndexedDB的存儲限制?

[英]How to detect that IndexedDB's storage limit has been reached?

如何通過JavaScript IndexedDB API檢測達到存儲限制? 我設想在嘗試將數據寫入數據庫時​​,會收到通知,那里沒有更多空間了嗎?

Chrome會將“ QuotaExceededError”放在event.target.error.name ,以進行錯誤回調。 不過,我不確定這是否由其他瀏覽器完成。

儲存限制

單個數據庫項目的大小沒有任何限制。 但是,每個IndexedDB數據庫的大小可能會有限制。 此限制(以及用戶界面聲明該限制的方式)可能因瀏覽器而異:

Firefox: no limit on the IndexedDB database's size. The user interface will just ask permission for storing blobs bigger than 50 MB. This size quota can be customized through the dom.indexedDB.warningQuota preference (which is defined in http://mxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js).
Google Chrome: see https://developers.google.com/chrome...rage#temporary

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM