 <p>The code you gave was almost there. I needed the same thing for my code. I added information to the cookie (last time modified) and compare that to the current time. If there is enough space in between (in this case 1 second) then modify the cookie info. This works even if you have 15 tabs open.<br> <em>I took out the check for whether they have cookies turned on.</em> </p> <pre><code>$(function(){ resetCookies(); setTimeout(checkTime, 1000); }); function resetCookies(){ setCookie("loginTime",'10',1); } function checkTime() { var arrloginTime=getCookie("loginTime").split("--"); var loginTime=arrloginTime[0]; var dtmLastMod=new Date(arrloginTime[1]); console.log(loginTime); if (loginTime!=null &amp;&amp; loginTime!=""){ var dtmNow = new Date(); if ((dtmNow.getTime() - dtmLastMod.getTime()) &gt;= 1000){ var newTime=loginTime-1; if(newTime==0){ autoLogout(); return false;} setCookie("loginTime",newTime,1); } }else{ autoLogout(); return false;} setTimeout(checkTime, 1000); } function setCookie(c_name,value,exdays){ var exdate=new Date(); var dtmLastMod = new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + "--" + dtmLastMod + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function getCookie(c_name){ var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i&lt;ARRcookies.length;i++){ x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name){ return unescape(y); } } } function autoLogout(){ console.log('You have been logged out of this document due to inactivity.'); } </code></pre>