sessionStorage和localStorage的區別
今天就來說一下sessionStorage和localStorage的區別以及使用:
sessionStorage:
記憶體:sessionStorage大約能儲存5M左右
生命週期:瀏覽器視窗關閉就自動銷燬
屬性方法:
儲存資料:sessionStorage.setItem(key,valu)
獲取資料:sessionStorage.getItem(key)
刪除資料:sessionStorage.removeItem(key)
刪除所有資料:sessionStorage.claer()
------------------------------------------------------------------------------
localStorage
記憶體:localStorage能存20M左右
生命週期:永久儲存
屬性方法:
儲存資料:localStorage.setItem(key,value)
獲取資料:localStorage.getItem(key)
刪除資料:localStorage.removeItem(key)
刪除所有資料:localStorage.claer()
sessionStorage的生命週期是在頁面關閉時就銷燬
localStorage是永久儲存。
儲存空間上sessionStorage也是比localStorage小
相關文章
- localStorage和sessionStorage區別Session
- cookies sessionStorage和localstorage區別CookieSession
- cookie、sessionStorage、localStorage的區別?CookieSession
- localStorage與sessionStorage 區別Session
- localStorage,sessionStorage和cookie的區別及使用SessionCookie
- localStorage、sessionStorage、Cookie的區別及用法SessionCookie
- 請描述一下cookies、sessionStorage和localStorage的區別?CookieSession
- Cookie、localStorage 和 sessionStorage 的區別及應用例項CookieSession
- 理解cookie、session、localStorage、sessionStorage的關係與區別CookieSession
- localStorage、sessionStorage、Cookie的SessionCookie
- localStorage 與 sessionStorage / cookie 和 sessionSessionCookie
- cookie、sessionStorage、localStorageCookieSession
- cookie, sessionStorage, localStorageCookieSession
- localStorage和sessionStorage原型方法新增Session原型
- localStorage和SessionStorage,Application,Cache快取SessionAPP快取
- localStorage和sessionStorage儲存封裝Session封裝
- 【基礎梳理】cookie、session、sessionStorage、localStorage之間的區別及應用場景CookieSession
- Cookie LocalStorage SessionStorage對比CookieSession
- Yet another intro for localStorage and sessionStorageSession
- web本地儲存(localStorage、sessionStorage)WebSession
- 詳說 Cookie, LocalStorage 與 SessionStorageCookieSession
- H5本地儲存:sessionStorage和localStorageH5Session
- cookie,session,sessionStorage,localStotage的區別CookieSession
- Cookie && Session && localStorage && sessionstorage && HTTP快取CookieSessionHTTP快取
- 前端存貯全家桶--cookie、sessionStorage、localStorage、和indexedDB重點合集前端CookieSessionIndex
- 移動Web——localStorage,sessionStorage,Storage事件監聽WebSession事件
- HTML5本地儲存localStorage與sessionStorage詳解HTMLSession
- 深入瞭解瀏覽器儲存:對比Cookie、LocalStorage、sessionStorage與IndexedDB瀏覽器CookieSessionIndex
- 登入過期--localStorage加sessionStorage實現7天登入過期Session
- sessionStorage中的setItem和getItemSession
- ../和./和/的區別
- LinkedList和ArrayList的區別、Vector和ArrayList的區別
- http和https的區別/get和post的區別HTTP
- ||和??的區別
- /*和/**的區別
- jquery $(this) 和this的區別jQuery
- JQuery this和$(this)的區別jQuery
- T和?的區別