HTML5 sessionStorage limits?

Cubed Eye picture Cubed Eye · Aug 4, 2012 · Viewed 17.4k times · Source

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?

Answer

Jigar Pandya picture Jigar Pandya · Aug 4, 2012
  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/