问题
I am looking into using browser sessionStorage for a web application, and was trying to find current information on size limitations. It appears most desktop browsers have imposed a 5MB limit. However, I am not finding many recent articles nor information on the mobile browsers.
The Disk space of the W3C Web Storage specification says "A mostly arbitrary limit of five megabytes per origin is recommended. Implementation feedback is welcome and will be used to update this suggestion in the future."
The QuirksMode HTML5 compatibility page for localstorage has its last major update on 12 June 2009 and only includes data for last years current browsers: IE8, FF 3.5b4, Saf 4, Chrome 2.
According to Introduction to DOM Storage, IE8 "allows Web applications to store nearly 10 MB of user data." Introduction to sessionStorage seems to confirm that "Firefox’s and Safari’s storage limit is 5MB per domain, Internet Explorer’s limit is 10 MB per domain."
Web Storage: easier, more powerful client-side data storage from the Opera developer site states "As of now, most browsers that have implemented Web Storage, including Opera, have placed the storage limit at 5 Mb per domain."
A recent chromium issue (#42740) put a 5mb quota on session storage.
Chapter 5. Client-Side Data Storage from Building iPhone Apps with HTML, CSS, and JavaScript states "At the time of this writing, browser size limits for localStorage and sessionStorage are still in flux."
Question: Based on this info, should I just assume 5MB is the limit or should I spend time testing different browsers? Does anybody know of an existing test suite (a la Browserscope) that would have these results?
回答1:
Assuming that the smallest limit for html5 web storage is 5mb, it would be sensible to go with that answer given what information you have presented, and has been presented about W3C web storage. Do beware that everything is in flux, but I don't think this limit will change drastically.
回答2:
A site with some web storage info http://dev-test.nemikor.com
as you can see the quota's are different for each browser!
回答3:
I've read from some bug report comments that Chrome stores localStorage data in UTF-16, which effectively doubles the sized used, leaving you with something more like 2.5mb. I think this might also be the case for other webkit browsers as well, if they impose the 5mb limit.
The fact that almost a year after this question was asked it still isn't easy to find the size limits (or even the key/value charset) is crazy.
来源:https://stackoverflow.com/questions/3232872/is-5mb-the-de-facto-limit-for-w3c-web-storage