HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptCritical

Are there any benefits to Session Storage over Local Storage?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
benefitsareanystorageoversessionlocalthere

Problem

Apart from being non persistent and scoped only to the current window, are there any benefits (performance, data access, etc) to Session Storage over Local Storage?

Solution

localStorage and sessionStorage both extend Storage. 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 tab. Changes made are saved and available for the current page in that tab until it is closed. Once it is closed, the stored data is deleted.

Context

Stack Overflow Q#5523140, score: 1103

Revisions (0)

No revisions yet.