Scope of sessionStorage and localStorage
I read some documentation on sessionStorage and localStorage, but I don’t understand what the scope is: the domain, a specific page?
For example, if I have the following pages:
And if on each of the above pages I run (with idvalue being the value in the querystring):
Am I going to end up with 3 different values stored, or are the values going to overwrite each other?
The values are going to overwrite each other. Each key-name pair is unique for a protocol and domain, regardless of the paths.
The affected domain can be changed via the
example.comis possible (subdomain)
other.example.comis not possible
Values persist only as long as the window or tab in which they stored.
Values are only visible within the window or tab that created them.
Values persist window and browser lifetimes.
Values are shared across every window or tab running at the same origin.
So, by reading and understanding this each key-value pair is unique for each domain, because local storage persist values across window or tab.