Use the clearTimeout() and setTimeout() functions whenever there is a mouse or keyboard event with the setTimeout triggering the function you want to have run after the appropriate amount of idle time. That way that function will only run when the required idle time occurs as any mouse or keyboard event will cancel the existing timeout call and start a new one.
if I’m at a.jsp and use window.open() to get b.jsp (which will redirect to another website), how to check if the pop up window is idle or its is still active?
var childWindow = window.open(‘b.jsp’,'childWindow ');
//redirect to 3rd party content
Currently we have time tracking,but we hope the time tracking will stop after childWindow idle more then 5 minutes.
I’ve tried childWindow.location.href or childWindow.history.length but all failed due to security reason. Is there anyway to check popup window’s status?
On all related events like mousemove, mouseup, mousedown keyup, keydown …
clearTimeout(thecurrentTimeout); thecurrentTimeout = setTimeout(setIdle,30000);//30s
Thank you for reply.
I’ve tried some code for the related events, but we can’t use any of those when the pop up window actually displaying content from different domain. You’ll see ‘Access is denied’ in IE and ‘Error: uncaught exception: Permission denied to get property HTMLDocument.url’ in FireFox.
Is there any tricks to handle this security issue?