-1

I'm using this posts Answer to maintain session after login, yes its working fine till i refresh the browser, after that all is gone. what is the problem? how to implement and maintain session using closure?

ayyanar pms
  • 169
  • 1
  • 2
  • 13

1 Answers1

-1

The point of a session is that it only lives for so long as the browser is open.

The example you use isn't even a session. The data store is an in-memory JS data structure, so it only lives while the page is open.

If you want data to persist after you close the browser then you need to store it in some persistent data store.

On the client, localstorage is probably your best option.

You would probably be better of storing the data server side and then retrieving it next time the user logs in. It won't be tied to a specific browser or at risk of being accidently deleted if the user clears their local data.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335