HTML5 sessionStorage limits?
Asked Answered
F

1

16

A few questions regard HTML5's sessionStorage:

  • Does the 5MB limit on localStorage include sessionStorage? (ie. is it really a 5MB limit on the WebStorage API)
  • If not does sessionStorage have a maximum size limit similar to localStorage?

I found this site http://dev-test.nemikor.com/web-storage/support-test/ in another SO questions, I'm wondering if the data is still relevant?

Fund answered 4/8, 2012 at 6:25 Comment(0)
R
17
  1. Does the 5MB limit on localStorage include sessionStorage? (Answer: NO)
  2. is it really a 5MB limit on the WebStorage API (Answer: NO; Supported By )
  3. does sessionStorage have a maximum size limit similar to localStorage? (Answer: NO; Supported By )

Hope I answered all your questions in a simplified manner. Here is a particularly informative section for you:

QUOTAS

You can imagine the chaos if any website was allowed to populate unsuspecting hard drives with gigabytes of data! Thus, browsers impose limits on storage capacity. When your app attempts to exceed that limit, the browser will typically show a dialog to let the user confirm the increase. You might expect the browser to enforce a single limit for all storage an origin can use, but the major browsers are actually enforcing limits separately for each storage mechanism. This may change in the future, but for now, you should think of the browser as maintaining a 2-D matrix, with "origin" in one dimension and "storage" in the other. For example, "http://abc.example.com" is allowed to store up to 5MB of Web Storage, 25MB of Web SQL Database Storage, and forbidden to use Indexed Database. Another welcome enhancement in this area would be user interfaces to let users view and control how much space they have allocated for each origin. There are also environments where the user can see upfront how much storage will be used, e.g. in the case of the Chrome Web Store, when a user installs an app, they will be prompted upfront to accept its permissions, which include storage limits. One possible value is "unlimited_storage".

The above text taken from http://www.html5rocks.com/en/tutorials/offline/storage/

Rightwards answered 4/8, 2012 at 7:6 Comment(3)
That's what the spec says and it's definitely helpful to know... but in practice real browsers have limits. Chrome's appears to be 2.5MB.Steal
Thanks ELI for that.. :)Rightwards
This is why just posting links is a terrible idea, all dead.Wiltshire

© 2022 - 2024 — McMap. All rights reserved.