如何浏览后退按钮已禁用,如Gmail,Yahoomail. [英] How to browser Back Button Disabled like Gmail,Yahoomail.

查看:87
本文介绍了如何浏览后退按钮已禁用,如Gmail,Yahoomail.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

从邮件注销后,如何浏览器的后退按钮已禁用.
像Gmail,Yahoomail.
使用Java脚本和asp.net,C#
注意:没有页面加载.


使用COde发送.

通过mohan.

Dear one,

How to browser Back Button Disabled after LOGOUT from mail.
like Gmail,Yahoomail.
Using java script and asp.net,C#
Note: WithOut Page Loading.


sent with COde.

By mohan.

推荐答案

单击注销后,在服务器端执行下面的代码



After clicking logout uexecute the bellow code in server side



<script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script>


在后面的代码中这样写:

收合|复制代码

On code behind write this:

Collapse | Copy Code

protected void Page_Load(object sender, EventArgs e)
   {
      
     HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
     HttpContext.Current.Response.Cache.SetNoServerCaching();
     HttpContext.Current.Response.Cache.SetNoStore();
    
 
   }





然后在客户端写这样的东西:

收合|复制代码





and on client side write something like this:

Collapse | Copy Code

<script type="text/javascript" language="javascript">
window.history.forward(1);
document.attachEvent("onkeydown", my_onkeydown_handler);
function my_onkeydown_handler()
{
switch (event.keyCode)
{
case 116 : // F5;
event.returnValue = false;
event.keyCode = 0;
window.status = "We have disabled F5";
break;
}
}
</script>



这篇关于如何浏览后退按钮已禁用,如Gmail,Yahoomail.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆