lundi 30 mars 2015

How to keep localstorage session specific?

So we have a web application that is accessed through a link from an email. When the user clicks on the link, we call a web service to pull the necessary data to the client. This data is then stored in the client's localstorage for the span of the user's session and cleared after.


The problem here is that if a user clicks on the link twice and logs out of one of the sessions, the local storage is cleared for both of the sessions.


So I've been thinking about solving this issue and here are my possible solutions:



  1. Reusing the same tab for the external links of the same domain. But its not possible as of now.

  2. Append the session Id to the keys of the localstorage and clear only them at logout. But in this case if someone does not logout properly, the local storage items will still persist and we don't want that.


So I'd like to know if there is any way to keep the local storage session specific or else if I should be skipping localstorage entirely. Thanks!


Aucun commentaire:

Enregistrer un commentaire