Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Revising my answer here a bit because you already mentioned the server side timeout….</p> <p>The only thing you can do client side is to use the onbeforeunload event to call the logout page (if the user did not click a link in the document..)</p> <p>Unfortunately, the browser back, forward, and refresh buttons will cause a logout...<br> To get around that, have your logout.php (auto logout page) sleep for 20-30 seconds and then check to see if the last impression was under 30-45 seconds ago before logging them out…</p> <p>Just add this to script tags in the head of your document and change the ‘logout.php’ to whatever you want… <em>*</em> You may also need to edit the window.onload function to correctly add the onclick handlers if you use something other than links to navigate….</p> <pre><code> var xmlhttp=false; var target; var combo; /*@cc_on @*/ /*@if (@_jscript_version &gt;= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp &amp;&amp; typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } var dologout = true; var logouturl = 'logout.php'; window.onbeforeunload = function() { if (dologout) { xmlhttp.open("POST", logouturl, true); xmlhttp.send(null); } } window.onload = function() { for (i=0;i&lt;document.links.length;i++) document.links[i].setAttribute("onclick","dologout = false;"); } </code></pre> <p>Essentially this just attaches an onclick event to all document.links and changes the 'dologout' flag to false if a document link was clicked... </p> <p>If the dologout flag is true when the onbeforeunload event fires, it sends a post to the 'logouturl' / 'logout.php' ... </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload