比如:
更多相关知识访问这里:http://www.w3school.com.cn/html5/html_5_webstorage.asp
希望能够帮到你
1.检查当前所用浏览器是否支持localStorage:
if(window.localStorage){
alert('This browser supports localStorage');
}else{
alert('This browser does NOT support localStorage');
}
2.向localStorage存储数据:
window.localStorage.setItem("key",value);
3.从localStorage中取出key为"hello"的数据:
window.localStorage.getItem("hello");