如何禁用后退/前进按钮 [英] How To Disable Back/Forward Button
本文介绍了如何禁用后退/前进按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过C#代码在asp.net中禁用客户端浏览器的来回导航
在此先感谢
How can i disable back and forward navigation of client''s browser in asp.net through C# code
Thanks in Advance
推荐答案
Don''t.这很烦人,用户会找到解决方法(或者停止使用您的网站并访问一个不太烦人的竞争对手).
相反,您应该以一种可以随时移动到任何页面的方式编写应用.大多数页面都可以缓存;设置Cache-Control和Expires标头以允许此操作,它将按用户期望的那样工作.如果页面确实是一次性关键或安全关键的页面,请将其设为不可访问(通过标头),并让页面代码检查应用程序是否处于正确状态,并显示错误或重定向(真实的HTTP) 303输入一个)(如果不是).
Don''t. This is very annoying and the user will find a way around it (or stop using your site and visit a less annoying competitor''s).
Instead, you should write your app in such a way that it can cope with moving to any page at any time. Most pages can be cached; set Cache-Control and Expires headers to allow this, and it will work as the user expects. If a page is really one-time-critical or security-critical, make it non-cachable (through headers) and have the page code check whether the application is in the right state, and display an error or a redirect (a real HTTP 303 type one) if not.
同意Bob的意见,请检查此技巧/窍门
注销后浏览器后退按钮问题 [
Agree with Bob, check this Tip/Trick
Browser back button issue after logout[^]
这篇关于如何禁用后退/前进按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文