when I refresh the browser all the values stored in localStorage are gone. is there a way to prevent the browser to delete it?
localStorage.setItem("loggedIn", false);
thanks
when I refresh the browser all the values stored in localStorage are gone. is there a way to prevent the browser to delete it?
localStorage.setItem("loggedIn", false);
thanks
localStorage
is also known as Web Storage, HTML5 Storage, and DOM Storage.
localStorage
is similar to sessionStorage
, except that data stored in localStorage
has no expiration time, but sessionStorage
gets cleared when the browsing session ends (i.e. when the browser is closed).
localStorage
is available on all browsers, but persistence is not consistently implemented. Furthermore localStorage
can be cleared by user action.
In Firefox, localStorage
is cleared when these three conditions are met:
user clears recent history,
cookies are selected to be cleared
time range is "Everything"
In Chrome, localStorage
is cleared when these conditions are met:
clear browsing data,
"cookies and other site data" is selected,
timeframe
is "from beginning of time".
In IE, to clear localStorage:
Tools-->Internet Options
,
General tab,
delete browsing history on exit
In Safari:
Click Safari
Preferences
Select the Privacy tab
Click Remove all website data