在所有浏览器中将向后按钮设置为禁用 [英] set the backward button to disabled in all browsers

查看:86
本文介绍了在所有浏览器中将向后按钮设置为禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个门户网站,我想在用户注销后将后退"按钮设置为禁用状态.

通过C#编程是否有可能,还是我们需要使用Javascript或jquery之类的客户端脚本?

Hi everyone,

I have a portal site and I want to set the backwards button to disabled state after the user gets logged out.

Is it possible by C# programming, or do we need to go for client side scripts like Javascript or jquery?

Please help me regarding this.

推荐答案

好像您错过了此提示:
Looks like you missed this tip: Browser back button issue after logout[^]


设置window.history.back(-1);在javascript onload事件中
set window.history.back(-1); in javascript onload event


登出页面的表单加载事件中写入此内容.

on form load event of logout page write this .

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
      HttpContext.Current.Response.Cache.SetNoServerCaching();
      HttpContext.Current.Response.Cache.SetNoStore();





Session.Abandon();
      Response.Redirect("~/Login.aspx");








or


<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>


这篇关于在所有浏览器中将向后按钮设置为禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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