Try inserting alert (typeof(localStorage))
You will see that this returns object in Chrome, but undefined in IE in off-line mode. In other words, IE does not support local storage when run, er, locally. Upload the script to a server and then IE returns object and confirms that local storage is in fact supported. "Hello World" is written to the screen.
All browsers from IE8 onwards support localStorage. But in IE (and Firefox, I Think) localStorage is only available on HTTP websites.
The code I gave you correctly identifies that IE (and other browsers) supports local storage, but as I say you cannot use local storage in IE offline. Which is a pity!
If you develop your website using Google Chrome, then you can test it out offline, and it ought to work fine in IE when uploaded to a server.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Last edited by Philip M; 04-05-2013 at 09:28 AM..