The below code works for the most part but I am wondering if it's possible to tweak it a bit. If there is no mouse activity for x number of milliseconds, a popup window is displayed saying that you will be logged out. Then, if / when you click the ok button the script will automatically bring you to the logout file.
However, I would also like to bring the screen to the logout.php file if the ok button is not clicked after x number of milliseconds. Does anyone know how I might do this with the below code? Thanks
// Set timeout variables.
var timoutWarning = 840000; // Display warning in 14 Mins.
var timoutNow = 100000; // Timeout in 15 mins would be 900000.
var logoutUrl = 'logout.php'; // URL to logout page.
var warningTimer;
var timeoutTimer;
// Start timers.
function StartTimers() {
warningTimer = setTimeout("IdleWarning()", timoutWarning);
timeoutTimer = setTimeout("IdleTimeout()", timoutNow);
}
// Reset timers.
function ResetTimers() {
clearTimeout(warningTimer);
clearTimeout(timeoutTimer);
StartTimers();
$("#timeout").dialog('close');
}
// Show idle timeout warning dialog.
function IdleWarning() {
// $("#timeout").dialog({
//modal: true
alert("Warning, your page will redirected to login page. Due to not move your mouse within the page in 15 minutes.");
//});
}
// Logout the user.
function IdleTimeout() {
window.location = logoutUrl;
}