title: How to Call a javascript function every 15 sec, for 5 mins only and how to check page is idle for some time
body: <p>I have written this function which calls automatically every 15 secs each.</p>
  
  <pre><code>setInterval(
    function () {
      check_alive_status();
    }, 
    15000 // every 15 seconds
  );
  </code></pre>
  
  <p>Now my requirement is, i have to run this function only for first 5 minutes, and afterwords it should not be called. How can i achieve it? Any way there?</p>
  
  <p>I need to check if any background processes like any ajax call or a file upload happening in that web page also. If nothing is running and the page is idle, then after 15 min, i have to logout the user. How to check that also?
  Thank You!</p>