Given a certain amount of time before the session expires, a dialog is shown to the user with the option to either log out now, or stay connected. If log out now is selected, the page is redirected to a logout URL. If stay connected is selected, a keep-alive URL is requested through AJAX. If no options is selected before the session expires, the page is automatically redirected to a timeout URL. The time left of the session is retrieved from the server through ajax in json format. This implementation works nicely with multiple tabs