I am developing a project management system. I am trying to track working time of a user. The time tracking page contains a timer and the user start tracking before they start their work. Its working perfectly but in the case of system shut down or idle the time tracker doesn't stop. How can I check the system (Not the browser window or tab) is idle or not?And I want to show a confirmation message if browser tab is closed.I am use the code
$( [window, document] .on( 'beforeunload ', function () {
//alert
});
But "beforeunload" can't return any value.How to return a true or false value in beforeunload function in javascript