HTML and CSS Reference
For a basic Google search on the desktop, data is stored differently than on mobile. First,
sessionStorage is used, so you know this will be temporary data. Looking at the raw
JSON data stored by a simple Google search in Figure 6-5 , you can see mostly CSS and
HTML is stored along with some namespaced tracking data.
Figure 6-5. Google's use of sessionStorage on desktop
Twitter also makes heavy use of localStorage on mobile devices. Looking at the JSON
saved on the device in Figure 6-6 , you can see that Twitter stores all of the data required
to present the user interface. The data isn't a straight dump of HTML to localStor
age , however, it's organized in a JSON object structure with proper escaping and Java‐
Script templating variables.
Figure 6-6. Twitter's use of localStorage on mobile
Amazon's use of sessionStorage is minimal tracking information related to “product
likes.” But overall, it's a bit surprising to see that the top sites on the Internet are still not
leveraging Web Storage to speed up their site and reduce HTTP requests.
Efficient requests and zippier interfaces may not be a huge problem for desktop sites,
but there's no reason we shouldn't have these storage enhancements on both mobile and
desktop. Some of the reasons we're seeing heavy Web Storage usage only on mobile are:
• Data URIs (base64 encoding background images) used in CSS work with modern
browsers only. There are limits and annoyances with this technique all the way up
• Mobile latencies are much higher (as you saw in Chapter 3 ), so caching on mobile
devices can make the UI much faster.