In this article I will explain how to show alter message when user idle or inactive for sometime on website in asp.net using JQuery.
Description:
In previous articles I explained many articles on JQuery. Now I will explain how to show alert message when user idle for sometime on website in asp.net using JQuery.
Generally in banking sites if we stay ideal for sometime automatically we will get alert like your idle for this much time on site and your session is going to expire within 5 minutes or something else we can implement this functionality easily by using available JQuery plug-in. For that first create new website write the following code in your aspx page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Show alert message when user idle for sometime on webiste</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js"></script>
<script type="text/javascript" src="jquery.idle-timer.js"></script>
<script type="text/javascript">
$(function()
{
var timeout = 5000;
$(document).bind("idle.idleTimer",
function() {
$("#status").html("User is idle :(").css("backgroundColor", "silver");
alert("user
idle for more than "+ (timeout/1000)+"
secs")
});
$(document).bind("active.idleTimer",
function() {
$("#status").html("User is active :D").css("backgroundColor", "yellow");
});
$.idleTimer(timeout);
});
</script>
</head>
<body>
<form runat="server" id="form1">
<h1>Aspdotnet-Suresh.com</h1><h3>Showing
User Active & Idle Status based on Time</h3>
<div id="status"
style="padding: 5px;"> </div>
</form>
</body>
</html>
|
To know more about this JQuery plugin check these sites JQuery Idletimer-plugin and JQuery tooltip demo page idletimer-plugin Demo
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|


Subscribe by RSS
Subscribe by Email
0 comments :