0

I was looking for some clarification really. Looking at the W3Schools documentation on localStorage and sessionStorage, they write:

Local storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data.

Does this mean that if I have multiple web front ends, and my load balancer is not using sticky sessions, that the data I store with the sessionStorage object may not be accessible, dependent upon which WFE serves the data?

Just a little unclear, and it's difficult to test. Many thanks!

George Grainger
  • 172
  • 2
  • 15

1 Answers1

1

localStorage and sessionStorage are both stored in the browser, so your load balancer, sticky sessions, etc. will not affect these at all. They may affect any data you store in the session on your server though.

The difference between localStorage and sessionStorage is that sessionStorage is stored cleared when the page session ends, whereas localStorage has no expiration set.

halfer
  • 19,824
  • 17
  • 99
  • 186
Ian Oxley
  • 10,916
  • 6
  • 42
  • 49
  • Sorry, not quite there: "any data you store in the session on your server". Meaning any data I store pertaining to the session, on the server? rather than the client? – George Grainger Apr 11 '16 at 13:35
  • @GeorgeGrainger Yes. So any server-side session storage you use may be affected by load balancing, etc. Anything you do using JavaScript via window.sessionStorage or window.localStorage stores data in the user's browser only: this doesn't get stored on the server, so shouldn't be affected by load balancing. – Ian Oxley Apr 11 '16 at 13:46