The pushState
method accepts a state object. Firefox documents say the maximum size of this object is 640kb. Is it defined in the specs what the smallest maximum size a browser can implement is? Can I reasonably expect major browsers to provide me with at least 100kb?
EDIT: I tested it out with Chrome, and it was still working for state objects over 1MB.
The specification doesn't set out a limit, however the various browser do have their own limits.
Firefox's is well documented and as you said, it's 640kB ("as much RAM as anybody will ever need").
I couldn't find Chrome or Internet Explorer's listed anywhere, but some quick testing shows:
Chrome working at least up to 10MB (and possibly further),
IE hitting the limit at 1MB (in IE11, which is all I have handy).
So, to summarise for the people of the future:
history.state object size limit is: 640kB
for Firefox, 1MB
for Internet Explorer 11 and at least 10Mb
for Chrome.
EDIT: Versions tested: IE: 11, Chrome: 33, Firefox: Irrelevant as they document the max size on MDN for you :).
No. The normative document here is http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#dom-history-pushstate and it doesn't even mention a limit for the data size. A different limit is suggested however:
User agents may limit the number of state objects added to the session history per page.
As you can see on this example the specification generally avoids mentioning any hard limits and leaves them at the discretion of browser makers. So even if the spec is revised at some point in future to consider the possibility of data size limits, it is unlikely to give you a real number. Instead it will be "big enough for common use cases".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With