1、localStorage的浏览器支持情况
localStorage属于永久性存储,不移除永久存在;sessionStorage属于会话结束就消失。
localStorage存储的大小在5M左右,不同浏览器有所区别。
2、localStorage存储
localStorage.setItem(key, value);
3、localStorage读取
localStorage.getItem(key)
4、localStorage移除
localStorage.removeItem(k);
5、localStorage循环
for (var i = 0; i < localStorage.length; i++) { var k = localStorage.key(i); var v = localStorage.getItem(k); }