After Andrew’s presentation, somebody asked whether the content of HTML5 storage would survive the user clearing the cache, and nobody in attendance was certain. In retrospect, I’m sure I already knew the answer to this, somewhere in the bowels of my memory, but it eluded me at the time. But I got curious and decided to test it out:
The text boxes show what’s currently stored. Enter something in either one and click the button to store it. If you navigate to this page in a new window or tab, or quit and relaunch your browser and come back, localStorage will remain and sessionStorage will disappear.
Then try clearing your cache and reloading the page. It looks like everything survives. I only tried this in Firefox 3.6 and in Safari 4.1 and 5.0. Please try it out in the browser of your choice and leave a comment if you find different behavior anywhere. (Also, I’m not sure every detail of what I’ve done is cross-browser compatible, so please leave a comment if the basic functionality is missing in some browser that’s supposed to support this, and I’ll fix it.)
The way the Safari developer tool (the Web Inspector) lets you inspect this data suggests that it treats local storage more like cookies than like the cache. If you click on Storage, it shows three databases: “LOCALSTORAGE”, “SESSIONSTORAGE”, and “COOKIES”. Click on them and you can examine the contents of each. No sign of the cache in that panel.