怎么用HTML5的Local Storage把某网页的数据保存到本地(local drive),在无网的情况下也能访问本地数据

2024-12-23 03:40:44
推荐回答(2个)
回答1:

比如:


更多相关知识访问这里:http://www.w3school.com.cn/html5/html_5_webstorage.asp

希望能够帮到你

回答2:

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");