Jump to content

Session + Refresh, current best practice?


davor242

Recommended Posts

First of all, excuse my newbiness. :D

 

What is the current best practice, easiest, user-friendly way to have a session "survive" a F5 refresh?

Ideally, F5 refresh should bring the logged in user to the exact same state.

 

I understand that metadata (user,pwd,id) can be stored in a cookie. But that lacks the session state.

Can a session be restored from a cookie?

Do we have to manually track the state and restore it in a new session?

 

I am very new to all this so, if possible, could someone please explain why F5 Refresh has such a complete amnesia effect?

 

 

Link to comment
Share on other sites

Hi

Pressing f5 key is a fast and standard way to restart, forcing the browser to clean the cache and reload the entire web page, and as far as i know uniGui keeps that standard way, allowing you (besides other things) to update ExtJS lib when you upgrade uniGui (cause the browser MUST clean cache and reload that new ExtJS lib). So the user should know that when he press f5, the application will restart, just like closing and starting again the application or in this case, the browser (and the same with the tab).

This feature (cache control) was thought in the beginning of times to save time reloading media files (movies, images, big text files, scripts, etc.).

Moreover you can disable this f5 key effect, adding dkDisableF5 to MainModule.DocumentKeyOptions.

I hope another user/developer answers your question in a better way i'm doing, because maybe i'm wrong and uniGui indeed can restore the application state after pressing f5. But considering you can disable it, the only case in which you need uniGui keeps its state using a cookie (or something else), would be a browser restart or an entire client restart, what would bring some security issues.

Finally, i hate to answer a question with another one, but why would you press f5 to "restart" a web page to the same state it was before pressing it ?

Link to comment
Share on other sites

Thank you very much! I wasn't aware of dkDisableF5. :D Worked beautifully.

 

Additionally, after a quick google, I added this to MainForm.Script:

window.onbeforeunload = function() 
{
  return "You will be automatically logged out if you proceed with this action.";
};

...

 

To answer your follow-up question: It is all about reducing the number of support call when users loose their work. :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...