I am getting an error in internet explorer 11
"Unable to get property 'length' of undefined or null reference" on line
if (window.localStorage.length !== 0)
it works fine on chrome and Firefox, not sure whats causing it
<script>
function initialize() {
// test to see if brouser supports storeage api
var bSupportsLocal = (('localStorage' in window) && window.localStorage !== null );
if (!bSupportsLocal) {
document.getElementById('infoform').innerHTML = "<p> Sorry, This browser does not suport local storage. </p>";
return;
}
if (window.localStorage.length !== 0) {
document.getElementById('firstName').value = window.localStorage.getItem('firstName');
$.mobile.navigate("#benefits-facts");
}
}
function storeLocalContent(fName) {
window.localStorage.setItem('firstName', fName);
}
function clearLocalContent(strToStore) {
window.localStorage.clear();
}
window.onload = initialize;
</script>