javascript - Check if local storage value is equal to -
i know how check value of item stored in local storage true or false.
this have , if statement isnt working.
function setcbt(){ localstorage.setitem('testobject', true); } function alertlocalstorage(){ var object = localstorage.getitem('testobject'); if(object == true) { alert("this item true"); } else { alert("this item false"); } }
all implementations safari, webkit, chorme, firefox , ie, following old version of webstorage standard, value of storage items can string.
thus need compare value string:
if(object == "true") {
here alternative posted cms.
Comments
Post a Comment