The sites you mention probably guess when the session will expire and use a JavaScript timer. It's hard to know for sure when the session will expire because polling to assess its condition resets the counter.
Bear Bibeault wrote:JavaScript is all you have. If you send any kind of request back to the server, be it Ajax or not, the session counter resets so you can't use that technique to ask the server how much time is left.
When the page is generated to send to the client, you can create a JavaScript timer that's the duration of the session timeout.
Bear Bibeault wrote:Are you taking about browser tabs? Or something else?
How are you controlling how many browser tabs are opened? That's really us to the user.
Bear Bibeault wrote:So your users do this? Or are you spreading your app out over many windows with window.open()?
In any case, as each tab has it's own timer and is loaded correctly, what's the issue?
David Newton wrote:I think the OP is asking about opening a tab (counter starts at 30 minutes). A new tab is opened 15 minutes later and is in use. The first tab will time out in 15 more minutes and throw up even though the second tab is still active and the session isn't really over.
David Newton wrote:What if the JavaScript timeout was sent to something slightly *greater* than the server side timeout? At the end of the timeout an Ajax request is made; if the server session actually *has* timed out, the Ajax request could return a specific error code, and the JavaScript can throw up. If the server session *hasn't* timed out, all goes on as normal and nothing else happens.
My, my, aren't you a big fella. Here, have a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|