在Internet Explorer或其他浏览器中禁用后退按钮 [英] disable back button in internet explorer or other browser

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

问题描述

我有一个aspx页面,添加一些细节并重定向到另一个页面,但当我点击Internet Explorer中的后退按钮它显示添加的细节,所以我想禁用该后退按钮或当我点击互联网上的后退按钮然后它应该保留在该页面上

i have an aspx page that add some details and redirect to another page but when i click on back button in internet explorer it shows that added detail, so i want to disable that back button OR when i click on back button in internet explorer then it should be remain on that page

推荐答案

没有确定的方法可以做到这一点 - 因为所有浏览器都不同,脚本语言在所有浏览器上的工作方式略有不同。



一些http://viralpatel.net/blogs/2009/11/disable-back-button-browser-javascript.html帮助你实现这一目标 - 但随后,不确定这些是否有效。



其他一些方法在禁用后退按钮 [ ^ ]。
There is no sure way of doing this - because all browsers are different and scripting languages work slightly differently on all of them.

Some http://viralpatel.net/blogs/2009/11/disable-back-button-browser-javascript.html help you achieve this - but then, there is no certainty that these will work.

Some other approaches are discussed at Disabling the Back Button[^].


protected void Page_Load(object sender, EventArgs e)
      {
          Context.Request.Browser.Adapters.Clear();
          Response.Cache.SetExpires(DateTime.Parse(DateTime.Now.ToString()));
          Response.Cache.SetCacheability(HttpCacheability.Private);
          Response.Cache.SetNoStore();
          Response.AppendHeader("Pragma", "no-cache");

      }



在这两个页面中添加它将清除缓存。点击后退按钮,您将获得新页面服务器。


add this in your both the pages it will clear the cache.And by clicking on the back button you will get fresh page from the server.


查看我的博客了解更多详情:)



Web开发,禁用后退按钮 [ ^ ]
See my blog for more details :)

Web Development, Disabling the back button[^]


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

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