如何删除网络存储?
在本地计算机上存储敏感数据可能很危险,并且可能会留下安全漏洞。会话终止后,浏览器会立即删除会话存储数据。
要清除本地存储设置,您需要调用localStorage.remove('key');。其中“键”是您要删除的值的键。如果要清除所有设置,则需要调用localStorage.clear()方法。
<!DOCTYPE HTML>
<html>
<body>
<script>
localStorage.clear();
//重置点击数。
if( localStorage.hits ){
localStorage.hits = Number(localStorage.hits) +1;
} else{
localStorage.hits = 1;
}
document.write("总命中:" + localStorage.hits );
</script>
<p>Refreshing the page would not to increase hit counter.</p>
<p>Close the window and open it again and check the result.</p>
</body>
</html>热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便