Reputation: 57
I am creating an UI5 application.My question is how to set session timeout for inactive users.Is there any direct property for session time out?
Upvotes: 0
Views: 4910
Reputation: 1472
You can handle this using setTimeout and clearTimeout functions. Whenever the user does mouse move or key press, reset the timer using clearTimeout function and setTimeout again for the threshold limit.
Ex:
document.onmousemove = reset;
document.onkeypress = reset;
function reset() {
clearTimeout(threshold);
setTimeout(sessionTimeout, <interval>); // interval is in ms
}
If the user does not use the page at all for given interval, it automatically times out. I just gave you a use case, You can handle it based on your need. Hope this brief information helps you.
Upvotes: 1