收到新消息时,在gmail聊天中闪烁最小化的网页 [英] Blink a minimized webpage like in gmail chat when new message received
本文介绍了收到新消息时,在gmail聊天中闪烁最小化的网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在收到新邮件时,像在Gmail聊天中一样,闪烁最小化的网页。我正在从jquery函数中显示一个ajax模型弹出窗口。我想如果浏览器最小化,那么用户通过闪烁最小化的浏览器得到通知。
我尝试过:
blink a minimized webpage like in gmail chat when new message received. I am showing an ajax model popup from a jquery function. i want to if browser is minimized then user get notified by blinking the minimized browser.
What I have tried:
<asp:LinkButton ID="lnkFake" runat="server" />
<asp:ModalPopupExtender ID="mpeTimeout" BehaviorID="mpeTimeout" runat="server" PopupControlID="pnlPopup"
TargetControlID="lnkFake" OkControlID="btnYes" BackgroundCssClass="modalBackground"
OnOkScript="ResetSession()">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
<div class="header">
Session Expiring!
</div>
<div class="body">
Your Session will expire in <span id="seconds"></span> seconds.<br />
Do you want to reset?
</div>
<div class="btnSection" align="right">
<asp:Button ID="btnYes" runat="server" Text="OK" CssClass="yes" />
<%-- <asp:Button ID="btnNo" runat="server" Text="No" CssClass="no" />--%>
</div>
</asp:Panel>
<script type="text/javascript">
var myTimer;
var myTimer2;
var myTimer3;
function SessionExpireAlert(timeout) {
var seconds = timeout / 1000;
// document.getElementsByName("secondsIdle").innerHTML = seconds;
document.getElementsByName("seconds").innerHTML = seconds;
myTimer = setInterval(function () {
seconds--;
document.getElementById("seconds").innerHTML = seconds;
// document.getElementById("secondsIdle").innerHTML = seconds;
}, 1000);
myTimer2=setTimeout(function () {
//Show Popup before 20 seconds of timeout.
// alert('hi');
$find("mpeTimeout").show();
}, timeout - 60 * 1000);
myTimer3 = setTimeout(function () {
//alert(" Your Session has expired.");
window.location = '<%=ResolveUrl("~/CRM/Login.aspx") %>';
// window.location = "Expired.aspx";
}, timeout);
};
function ResetSession() {
//Redirect to refresh Session.
//window.location = window.location.href;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '<%=ResolveUrl("~/CRM/Login.aspx/ResetSession") %>',
dataType: "json",
success: function (data) {
clearInterval(myTimer);
clearInterval(myTimer2);
clearInterval(myTimer3);
SessionExpireAlert(data.d);
},
error: function (result) {
alert("Error");
}
});
}
</script>
推荐答案
find(mpeTimeout)。show();
},超时 - 60 * 1000);
myTimer3 = setTimeout(function(){
// alert(你的会话已过期。);
window.location ='<%= ResolveUrl(〜/ CRM / Login .aspx)%>';
// window.location =Expired.aspx;
},超时);
};
function ResetSession(){
//重定向刷新Session。
//window.location = window.location.href;
find("mpeTimeout").show(); }, timeout - 60 * 1000); myTimer3 = setTimeout(function () { //alert(" Your Session has expired."); window.location = '<%=ResolveUrl("~/CRM/Login.aspx") %>'; // window.location = "Expired.aspx"; }, timeout); }; function ResetSession() { //Redirect to refresh Session. //window.location = window.location.href;
.ajax({
type:POST,
contentType:application / json; charset = utf-8,
url:'<%= ResolveUrl(〜/ CRM / Login.aspx / ResetSession)%>',
dataType:json,
成功:函数(数据){
clearInterval(myTimer);
clearInterval(myTimer2);
clearInterval(myTimer3);
SessionExpireAlert(data.d);
},
错误:函数(结果){
alert(Error);
}
});
}
< / script>
.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: '<%=ResolveUrl("~/CRM/Login.aspx/ResetSession") %>', dataType: "json", success: function (data) { clearInterval(myTimer); clearInterval(myTimer2); clearInterval(myTimer3); SessionExpireAlert(data.d); }, error: function (result) { alert("Error"); } }); } </script>
这篇关于收到新消息时,在gmail聊天中闪烁最小化的网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文