davor242 Posted September 23, 2017 Share Posted September 23, 2017 First of all, excuse my newbiness. 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? Quote Link to comment Share on other sites More sharing options...
pedrisco Posted September 24, 2017 Share Posted September 24, 2017 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 ? Quote Link to comment Share on other sites More sharing options...
davor242 Posted September 24, 2017 Author Share Posted September 24, 2017 Thank you very much! I wasn't aware of dkDisableF5. 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.