I want to logout properly when browser is inactive with setInterval() function. When browser is active, setInterval is not counting. However, when browser stays idle then the function is counting.
How do I achieve setInterval counting even browser is active?
JavaScript
function session_checking() {
$.post("activitytime.php");
}
*//Every after 7 mins (60*7) after browser is inactive run activitytime.php*'
setInterval(session_checking, 1000*10);
PHP
<?php
session_start();
//Do the necessary database update
session_destroy();