Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 79dca9e17c
Fetching contributors…

Cannot retrieve contributors at this time

68 lines (59 sloc) 2.556 kb
<!DOCTYPE html>
<html lang="en">
<title>jQuery Idle Timeout</title>
<style type="text/css">
#idletimeout { background:#CC5100; border:3px solid #FF6500; color:#fff; font-family:arial, sans-serif; text-align:center; font-size:12px; padding:10px; position:relative; top:0px; left:0; right:0; z-index:100000; display:none; }
#idletimeout a { color:#fff; font-weight:bold }
#idletimeout span { font-weight:bold }
<link rel="stylesheet" type="text/css" href="examples.css" />
<div id="idletimeout">
You will be logged off in <span><!-- countdown place holder --></span>&nbsp;seconds due to inactivity.
<a id="idletimeout-resume" href="#">Click here to continue using this web page</a>.
<div id="bar">
<h1><a href="">eric<span>hynds</span></a></h1>
<div><a href="">&laquo; Return to Blog Post</a></div>
<div id="content">
<h2>jQuery Idle Timeout Demo - Style</h2>
<p>This idle timeout countdown is triggered after 5 seconds. <strong>Keep your mouse and keyboard still!</strong></p>
<p><img src="" alt="Example" /></p>
<p>A polling request is sent to the server every two seconds to keep the server side session alive. I've set this parameter to an <em>extremely</em> low number
for demo purposes (timeout is only 5 seconds), but in reality, this should be much higher.</p>
<p>View source to see markup &amp; CSS.</p>
<li><a href="example-dialog.htm">View the jQuery UI dialog example</a></li>
<li><a href="">Download &amp; follow on GitHub</a></li>
<li><a href="">Return to home page</a>
<script src="" type="text/javascript"></script>
<script src="src/jquery.idletimer.js" type="text/javascript"></script>
<script src="src/jquery.idletimeout.js" type="text/javascript"></script>
<script type="text/javascript">
$.idleTimeout('#idletimeout', '#idletimeout a', {
idleAfter: 5,
pollingInterval: 2,
keepAliveURL: 'keepalive.php',
serverResponseEquals: 'OK',
onTimeout: function(){
window.location = "timeout.htm";
onIdle: function(){
$(this).slideDown(); // show the warning bar
onCountdown: function( counter ){
$(this).find("span").html( counter ); // update the counter
onResume: function(){
$(this).slideUp(); // hide the warning bar
Jump to Line
Something went wrong with that request. Please try again.