O'Reilly logo

Instant HTML5 Local Storage How-to by Alex Libby

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Storing images within Local Storage (Become an expert)

Up until now, we've worked with storing text values in LocalStorage. I hope you agree that it is an easy process to perform, and that used with care, we can achieve some great results. I mentioned though, at the end of the last recipe, that we could really turn the tables, and start to store images in LocalStorage. We'll see how to achieve this, using a technique developed by Rob Nyman, a Technical Evangelist at Mozilla.

Getting ready

For this recipe, we will need a suitable image to store in LocalStorage. There is no hard and fast rule on size, but we should bear in mind that in reality LocalStorage can't hold more than 5 to 10 MB (depending on the browser), so it is wise to choose a sensible ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required