function supports_html5_storage() { try { window.localStorage.setItem( 'checkLocalStorage', true ); window.localStorage.removeItem( 'checkLocalStorage' ); return true; } catch ( error ) { return false; }; }; document.getElementById( 'result' ).textContent = 'localstorage: ' + supports_html5_storage();
<div id="result"></div> <script> initializeHeader( 'HTML5 localStorage getItem issue in IE8', 'http://stackoverflow.com/q/15319084/918414' ); </script>