Browser Page idle for 3 minutes Is it possible to find out if the browser page is idle for some time and prompt to the user?

Alessandro A. Garbagnati

This is a very simple html page that after a 1 minute (set with the IDLE_TIME variable) of total inactivity, it will diplay an alert box.
The "total" inactivity is defined using the <script for...></script> tags. As you can see the example is trapping any mouse move or click and any keypress. You can change the events according to what you need. Obviously, if you add events, you will slow down the page.

  	var IDLE_TIME = 60000;
  	var timerID = -1;
  	function resetTimer() {
  		if (timerID != -1) {
  	function startTimer() {
  		timerID = window.setTimeout("timeOut()",IDLE_TIME);
  	function timeOut() {
  		if (timerID != -1) {

  <script for="document" event="onmousemove()">resetTimer()</script>
  <script for="document" event="onclick()">resetTimer()</script>
  <script for="document" event="onkeydown()">resetTimer()</script>

 <body onLoad="startTimer()">
  <h1 align="center">Inactivity test</h1>
About | Sitemap | Contact