So slo it’s sometimes faster to query the netork (yes really) Only accessible from JavaScript Indexed/queryable data store in the broser. Marvelous. Reasonably ide support if you use both
JS PI, hard to invalidate, etc etc. (ho long do e have?) Caches HTTP responses, so can serve first page request, before JS PIs are available. Easy to cache binary files
info Boot code Main app code Main app CSS App HTML templates • Check cookie for user authentication • Remove redundant content only needed for boot • Examine URL, read requested content from ebSQL • Render page
aful. • Other storage options don’t offer a URL • Base-64 encode image data • Store in localStorage or ebSQL • Insert into DOM as data: URIs • 30% bloat, but also avoids netork operator recompression
: 5MB / 50MB 10MB 5MB 4KB total Up to 50 per domain ndroid (4) ? Unlimited 5MB Safari (5.2) : 5MB / Unlimited Unlimited 5MB Chrome (18) : Unlimited 5MB 5MB IE (10) i: 500MB 50MB 10MB Opera (11) : 5MB / Unlimited 50MB / Unlimited 5MB / Unlimited Firefox (11) i: 50MB / Unlimited Unlimited 10MB Storage limits Two figures separated by / indicate limit with and without user consent prompt, which appears automaBcally when you try to store more than the lower limit. The user may not consent to more than the upper limit.
encoding • Great idea for processing: fast string operations, full support for Unicode BMP • Terrible idea for storage of English text or base-64 encoded images.
precious quota! • Can make compromises on compatibility to get more storage efficiency 00 48 00 45 00 4C 00 4C 00 4F 00 20 00 57 00 4F 00 52 00 4C 00 44 H E L L O W O R L D
JavaScript to store UTF-8 data • Convert back to string pretending UTF-8 chars are UTF-16 ones (ssssh) • Just under 50% compression ratio • Good: Efficient storage • Bad: Slo to convert, lots of code
server side • Read char codes in pairs, construct ne string ith one char bitshifted on top of the other. • Good: Fast, almost as efficient as UTF-8, code is tiny.
out=''; if (s.length % 2 !== 0) s += ' '; for (i = 0, l = s.length; i < l; i+=2) { out += String.fromCharCode((s.charCodeAt(i)*256) + s.charCodeAt(i+1)); } return out; }
e’re only using base 64. • 64 characters requires only six bits • Potential 63% compression ratio • 6 divides into 48 • 8 base-64 chars per 3 UTF-16 chars