I have a web application implemented in Spring MVC, JSP.
Default session timeout is defined in web.xml is 30 min.
if use
You could send a cookie with the remaining time (in milliseconds) on every request. Then you can use setTimeout as suggested but test the value again when the timeout-function is executed. If the value has changed you can reset the timeout. Since the cookie is set for the whole domain it will always be correct even for ajax or other tabs.
var cookieName = 'sessionMsg';
var message = 'Your session is going to be end by 5 min, Please click OK to continue';
function getCookie(name)
{
var name = name + "=";
var ca = document.cookie.split(';');
for(var i=0; i