Can we use both local storage and session storage at the same time??storage types
Asked
Active
Viewed 466 times
-4
-
3what happens when you try? – TZHX Aug 01 '17 at 09:21
-
its not depend on angular, it is feature of HTML 5 – Vijay Raheja Aug 01 '17 at 09:35
-
Please do more research on the session and local storage. It's HTML feature. – Surjeet Bhadauriya Aug 01 '17 at 09:39
1 Answers
1
localStorage
and sessionStorage
both extend Storage
. We can use both of them in our application. But, there is no difference between them except for the intended "non-persistence" of sessionStorage
.
That is, the data stored in localStorage
persists until explicitly deleted. Changes made are saved and available for all current and future visits to the site.
For sessionStorage
, changes are only available per window (or tab in browsers like Chrome and Firefox). Changes made are saved and available for the current page, as well as future visits to the site on the same window. Once the window is closed, the storage is deleted.