Hey Guys,
I have a problem with users not clicking a “log out” button to end their session, but just closing the window. When they come back (after 10-90 minutes) - they just use “back” in the browser, or re-login and their old session is there (server seems to ignore the 20 minute timeout). This causes the application to appear “frozen”…
Is there a way to “log out” when closing the window?
Bob
What I’ve always done for Web Client apps is to not have them link directly to the web client url. The reason for that is it includes the session id in the URL, and so then its in their browser history. They bookmark it, use the back button, etc, and it all goes to hell.
So I replace the index.html file (or make like a new app.html) in application_server/server/webapps/root with something like this below. It loads the web client URL into an iframe (either http or https depending on how the loaded the page). So, when the user goes to https://yourapp.com and it hits index.html, it loads https://yourapp.com/servoy-webclient/ss/s/myApp into an iFrame with no border that takes up all the page.
The result is if they leave and go back, it starts a new session if the prior one was expired. If it wasn’t expired, it loads the prior session from the cookies that servoy sets.
If you want the sessions to expire more often and have more control of it. You can use the UserManager plugin, or built-in ClientManager plugin if you are on a more recent version of Servoy. They both have the ability to get idle time of clients and shut them down.
<html>
<head>
<title>My App Name</title>
<style type="text/css">
html {overflow: auto;}
html, body, div, iframe {margin: 0px; padding: 0px; height: 100%; border: none;}
iframe {display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden;}
</style>
</head>
<body>
<iframe id="servoyFrame" src="" width="100%" height="100%" frameborder="0" border="0" scrolling="auto">
<p>Your browser does not support iframes.</p>
</iframe>
<script type="text/javascript">
if (window.location.protocol != "https:")
window.location.href = "https:" + window.location.href.substring(window.location.protocol.length);
var host = "https://" + window.location.host;
var url = host + "/servoy-webclient/ss/s/myApp";
document.getElementById('servoyFrame').src = url;
</script>
</body>
</html>
AH! OK. I think that will work for this particular application.
I’ll give it a whirl and see if it works!
I REALLY APPRECIATE your response, Scott! ![Smile :)]()