Friday, February 24, 2012

HTML5 code example: Intelligently store Images in localStorage for faster page loads! (design @ IBM developerWorks)

HTML5 code example: Intelligently store Images in localStorage for faster page loads! (design @ IBM developerWorks): "However I hit an immediate challenge, as localStorage only supports String objects, which is fine for Javascript and CSS, however I was also interested in storing binary Images.
 
 
Given this limitation in localStorage, the first step required for my implementation is to base64 encode the binary Images.   I found a website that offers an online tool to perform this encoding, however there are many shareware tools available to encode/decode binaries from your workstation or dynamically from a server application.  I converted my Images at OpinionatedGeek, which offers a simple web interface tool to quickly encode Images. Once you have base64 encoded your Images,  you will need to implement the Javascript and localStorage API to read & write your Images from the local client:
 "

'via Blog this'