2

One benefit of single page applications like Angular.js, is that you can store data in a global variable and access in multiple routes.

With multiple page applications, the data is lost during navigation. Ideally, such data should remain available on the user side while the user session is active. Using SessionStore does not solve this issue. There is the possibility of using LocalStore, but it is not limited to the session. One could fiddle something by extracting the session id from cookies.

Is there a better solution than using LocalStore?

1 Answers1

1

That's not an advantage. Global State is Evil.

Let's review over the things you've said:

  • Using SessionStore does not solve this issue - What? Why? It sounds exactly like you want. The browser knows what a "session" is a lot better than the server. It sounds to me that it's exactly what you want.
  • There is the possibility of using LocalStore, but it is not limited to the session. - That is true. localStorage sticks to the end of time, until you (or the user) delete it.
  • One could fiddle something by extracting the session id from cookies. - No, that's not true. localStorage and sessionStorage can only be accessed by scripts run on the same domain (same as cookies), except localStorage/sessionStorage are never sent to the server (unless explicitly done so with an AJAX request or similar techniques). If anything, one would manipulate cookies to steal the session ID.