The Web Storage spec recommends a 5mb quota per localStorage space -
javascript is UTF-16, thus 16 bytes per char, which means that for all
practical UTF-8/ascii use cases we're only getting 2.5mb of usable
space, enough to store about 260,000 chars. A limit worth remembering.
Best, Nathan
Hmm, I think you misunderstand slightly.
UTF-16 is 2 bytes (16 bits) per character, and UTF-8 is variable
length depending on what you are representing (1-4 bytes, 1 byte for
the common stuff). ASCII is a subset of UTF-8 which is guaranteed to
be 1 byte per character (7 bits).
So unless the Web Storage spec is talking about mega*bits* (which
would be pretty silly), then you are off by a factor of 10 - 2.5
million characters or more is a reasonable expectation. But it's
still a limit, many apps would hit that quite rapidly.
:-)
--
Bjarni R. Einarsson
Founder, lead developer of PageKite.
Make localhost servers visible to the world: http://pagekite.net/
Lol yes sorry! 2.6 million chars in chrome, not 260k! Thank for the catch :)
Data point: My personal blog is about 5.5 MB of plain text (stored as
a unix mbox file, actually), including metadata but not counting
comments and images and the like. Admittedly, it does go back to
1999, but hey, I typed it all myself and I'm not even a particularly
verbose writer.
People will hit these limits if the apps are useful. :-)