how to make session timeout with alert box
问题 I am using spring security, java in application. When the session gets expired, I need to show an alert that the session is over. The box should have an ok button which, when clicked, I want to redirect to login page.where should i put max time out and display alert message after time out. 回答1: Assuming that the session timeout timer is reset once a new page is loaded, you can simply use a JavaScript timeout: setTimeout(function() { if(confirm('session timeout')) location.href = 'login.html';