I have a CRM developed in PHP. I am developing an attendance system so that when a user logs in the CRM and clicks on the 'Shift Start' button then the agent will change that browser tab or minimize that tab and work on his system.
I need to check that the user is still using his system - I mean pressing the keyboard buttons and moving the mouse.
How can I detect that the user is active on his system or not as that tab is inactive or even he minimize his browser. Any jQuery code or suggestions please.
The challenge you have is that it seems your CRM is only used to start the shift, and the actual work is happening outside of the CRM. If so, any JavaScript code you develop and place in your CRM will only be able to detect mouse movement "inside" the browser window of the CRM.
Once a user's cursor goes "outside" the window (or in another tab), you won't know what it's doing. This is a good thing from a security perspective, and there is (fortunately) no way around it.