Javascript IndexedDB 中的最大项目大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5692820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maximum item size in IndexedDB
提问by EricSonaron
I'm working on a simple web utility that makes use of IndexedDB (similar to a key-value DB) feature of HTML5.
我正在开发一个简单的 Web 实用程序,它利用 HTML5 的 IndexedDB(类似于键值数据库)功能。
I was looking for but I was unable to know: what is the maximum size I can store in an item?
我一直在寻找,但我不知道:我可以存放在物品中的最大尺寸是多少?
采纳答案by Nickolay
I don't think there's a specific limit for a size of a single item, only a global limit.
我认为单个项目的大小没有特定限制,只有全局限制。
The rules regarding the global limit have changed since this answer was originally written. The up-to-date docs are on MDN- depending on the available disk space, the "group" limit (for the given domain, including all of its subdomains) can range from 10 MB to 2 GB.
自最初编写此答案以来,有关全局限制的规则已更改。所述向上的最新文档是关于MDN-取决于可用的磁盘空间,“基团”极限(对于给定的结构域,包括其所有的子域)的范围可以从10 MB到2 GB。
The older answer - obsoleted with the release of Firefox 38 (2015-05), which removed dom.indexedDB.warningQuota
:
较旧的答案 - 随着 Firefox 38 (2015-05) 的发布而过时,它删除了dom.indexedDB.warningQuota
:
From an answer by mbrubeckat support.mozilla.com (I've replaced the links he provided with perma-versions):
来自mbrubeck在 support.mozilla.com 上的回答(我已经用 perma-versions 替换了他提供的链接):
By default in Firefox 4, a site can use up to 50MB of IndexedDB storage. If it tries to use more than 50MB, Firefox will ask the user for permission: http://mxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#101
In Firefox for mobile devices (Google Android and Nokia Maemo), Firefox will ask for permission if a site tries to use more than 5MB: http://mxr.mozilla.org/mozilla-central/source/mobile/app/mobile.js#571[...]
If the user grants permission for a site to exceed the 50 MB IndexedDB quota, then as far as I know Firefox does not impose any more limits. The only limits on the size of the IndexedDB database will be the user's disk space and operating system.
The localStorage quota is 5000KB, and there is no way for a web site to ask the browser for permission to store more than that amount in localStorage.
默认情况下,在 Firefox 4 中,站点最多可以使用 50MB 的 IndexedDB 存储空间。如果它尝试使用超过 50MB,Firefox 将请求用户许可:http: //mxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#101
在用于移动设备的 Firefox(Google Android 和诺基亚 Maemo)中,如果站点尝试使用超过 5MB 的空间,Firefox 将请求许可:http: //mxr.mozilla.org/mozilla-central/source/mobile/app/mobile。 js#571[...]
如果用户授予站点超过 50 MB IndexedDB 配额的权限,那么据我所知,Firefox 不会再施加任何限制。IndexedDB 数据库大小的唯一限制是用户的磁盘空间和操作系统。
localStorage 配额是 5000KB,网站无法向浏览器请求在 localStorage 中存储超过该数量的权限。
回答by GemK
Adding to Nickolay answers, Here is the description of IndexedDB capacity in Chrome and IE
添加到 Nickolay 的答案中,这里是 Chrome 和 IE 中 IndexedDB 容量的描述
Chrome(Desktop): By default, For Web-apps chrome doesn't prompt the user while storing data using indexedDB API. It uses the concept of shared pool, here is the complete description - Chrome HTML5 Offline Storage
Chrome for Android: Couldn't find any official link for stating quota. But from my experience, i have saved 300 MB of data without any prompts. Most probably same behavior as Desktop Chrome.
- Internet Explorer 10: By default , user is prompted for storage at 10 MB. 250 MB per domain is the hard limit by default, however user can configure their own limits till 1 GB.
Chrome(Desktop):默认情况下,对于 Web 应用程序,chrome 在使用 indexedDB API 存储数据时不会提示用户。它使用了共享池的概念,这里是完整的描述——Chrome HTML5 Offline Storage
Android 版 Chrome:找不到任何用于说明配额的官方链接。但是根据我的经验,我在没有任何提示的情况下保存了 300 MB 的数据。很可能与桌面 Chrome 的行为相同。
- Internet Explorer 10:默认情况下,系统会提示用户提供 10 MB 的存储空间。默认情况下,每个域 250 MB 是硬限制,但用户可以配置自己的限制,直到 1 GB。