首页 > 技术文章 > Introduction to localStorage and sessionStorage

zacxu 2018-12-14 11:33 原文

localStorage vs sessionStorage

localStorage and sessionStorage accomplish the exact same thing and have the same API, but with sessionStorage the data is persisted only until the window or tab is closed, while with localStorage the data is persisted until the user manually clears the browser cache or until your web app clears the data. The examples in this post are for localStorage, but the same syntax works for sessionStorage.

https://alligator.io/js/introduction-localstorage-sessionstorage/

推荐阅读