how to completely clear localstorage
localStorage.clear();
how to completely clear sessionstorage
sessionStorage.clear();
[...] Cookies ?
var cookies = document.cookie;
for (var i = 0; i < cookies.split(";").length; ++i)
{
var myCookie = cookies[i];
var pos = myCookie.indexOf("=");
var name = pos > -1 ? myCookie.substr(0, pos) : myCookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
is there any way to get the value back after clear these ?
No, there isn't. But you shouldn't rely on this if this is related to a security question.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…