Hostingheaderbarlogoj
Join InMotion Hosting for $3.49/mo & get a year on Tuts+ FREE (worth $180). Start today.
Advertisement

Quick Tip: Learning About HTML5 Local Storage

by
Gift

Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.

This post is part of a series called HTML5 and You.
HTML5 Audio and Video: What you Must Know
The Official Guide to HTML5 Boilerplate

In today's video quick tip, we're going to build a working, though very basic, to-do list in just a minute or two. Thanks to HTML5's local storage, we can make advanced browsers "remember" what we type, even after the browser is closed or is refreshed.

"localStorage sets fields on the domain. Even when you close the browser, reopen it, and go back to the site, it remembers all fields in localStorage."
-QuirksBlog

While obviously not supported across all browsers, we can expect this method to work, most notably, in Internet Explorer 8, Safari 4, and Firefox 3.5. Note that, to compensate for older browsers that won't recognize local storage, you should first test to determine whether window.localStorage exists.

Support matrix

via http://www.findmebyip.com/litmus/
Advertisement