1

I am working on an web app and I would like to keep the client data in the LOCAL session storage.

I can't use the servers session and the app will only call some existing rest WS.I have to develop pure client side app, no server side rendering

In this case when going from one page to another I plan to read the data previously stored for each page from local session storage and render each page accordingly so refreshing the page will not affect the behavior by deleting client data for each page

I am sure is doable but is this a proper way keeping each page's data?

This is suitable for me because for years I have done frontend development with in Java Swing.

Thanks

3

Although using server side session state to store user data between page loads works, the downside is it eats memory on the server per user. So its not scalable.

keeping data in a cookie, although it seems old fashioned and you have to worry about its security. Is generally considered better.

A more modern approach is to use javascript client side databases. Or in a single page app you can simply persist the data in memory client side.

You can also get around the memory problem by storing the session in a DB or a separate scalable cache, such as memcache or aerospike etc However, this starts to raise more fundamental questions about the architecture of your application. Why do you need to have this state stored? is it actually better than regenerating it from a database on each page load? etc etc

Again in general I would say the popular view is to move towards stateless JSON services which are called via client side AJAX. (I'm not going to call it "REST" becuase its such a loaded term)

  • Sorry , i was not clear ...i meant client side session storage , cause i am not able to use servers session ,just rest ws to get data – Cris Sep 15 '15 at 8:09
  • updated : however, I'm not sure 'session state' is the correct term for client side storage. haven't heard it used this way before – Ewan Sep 15 '15 at 8:11
  • "The sessionStorage Object. The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the specific browser tab." – Cris Sep 15 '15 at 8:13
  • 1
    im showing my html4 age now!! :) re:shopping cart, yeah def keep this client side, even if you use cookies – Ewan Sep 15 '15 at 8:30
  • 1
    I think you are doing it right chris, but maybe you could expand you question to explain your worries more – Ewan Sep 15 '15 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.