I tried to put code in app.close and session.close, however when I close the tab in Chrome, neither event fires. I would like to remind user to explictly press logout button instead of just close the browser, thanks.
Why not simply logout the user in Session.TimeOut ? It would be a lot friendlier.
That is what most sites around do.
There’s a property on Session called ConfirmMessage which does exactly this.
Before you go setting values, take a moment to read up on what they’re for.
Session.Timeout sets an interval after which if a user exhibits no mouse or keyboard, an event will fire on the server (Session.Timeout) to allow you to automatically log them out if necessary. Think of what happens in a banking site if you just walk away and don’t log out.
App.Timeout sets the minimum amount of time that a session will hang around (on the server) after a browser stops communicating with the server, just in case the user comes back., At which time, Session.Close should fire. The de-facto standard for this is is 3 minutes, so I suggest leaving it at 180. Unfortunately that’s also still to late to prevent anything. The users already gone.
Take a closer look at the ConfirmMessage property I put above. http://documentation.xojo.com/index.php/WebSession.ConfirmMessage
Thanks Greg, I was just trying the suggestion from Michel…
session.ConfirmMessage is exactly what I want. But if I select “leave” when the message prompts up, where should I put code to logout user? Thanks
[quote=331229:@Tony Lam]Thanks Greg, I was just trying the suggestion from Michel…
session.ConfirmMessage is exactly what I want. But if I select “leave” when the message prompts up, where should I put code to logout user? Thanks[/quote]
Probably Session.Close. Just remember that it won’t fire immediately.
ok, I figured is session.close, as it does not fire immediately
Thanks Greg