Skip to content

HTTPS clone URL

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">
<head>
<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 }
</style>
<link rel="stylesheet" type="text/css" href="examples.css" />
</head>
<body>
<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>
<div id="bar">
<h1><a href="http://www.erichynds.com">eric<span>hynds</span></a></h1>
<div><a href="http://www.erichynds.com">&laquo; Return to Blog Post</a></div>
</div>
<div id="content">
<h2>jQuery Idle Timeout Demo - Mint.com Style</h2>
<p>This idle timeout countdown is triggered after 5 seconds. <strong>Keep your mouse and keyboard still!</strong></p>
<p><img src="http://www.erichynds.com/examples/jquery-idle-timeout/screenshot.gif" 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>
<ul>
<li><a href="example-dialog.htm">View the jQuery UI dialog example</a></li>
<li><a href="http://github.com/ehynds/jquery-idle-timeout">Download &amp; follow on GitHub</a></li>
<li><a href="http://www.erichynds.com">Return to home page</a>
</ul>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" 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(){
$(this).slideUp();
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
}
});
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.