【前端】Html5瀏覽器緩存 sessionStorage 與 localStorage
一、sessionStorage: 瀏覽關(guān)閉會話結(jié)束就被清除;(不能跨頁面)
localStorage:永久保存;
二、使用
var storage = window.sessionStorage; storage["key"] = "123";//賦值 alert(storage["key"] );//取值 storage.removeItem("key");//清除緩存 storage.clear();//清除所有緩存 //localStorage使用方法類同
三、參考:
https://my.oschina.net/adamboy/blog/74162
http://www.w3school.com.cn/html5/html_5_webstorage.asp

浙公網(wǎng)安備 33010602011771號