在浏览器中禁用“后退”按钮 [英] Disabling Back button in Browser

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

问题描述



当我导航到不同的页面时,我需要禁用浏览器的后退按钮。

每当用户提交数据时,它都不应该返回到上一个站点。 >
请帮帮我!

解决方案



真的不能禁用浏览器的Back按钮本身,但有办法解决这个问题。

一种方法是使用服务器端脚本来防止页面被缓存。这会强制浏览器转到服务器以获取页面而不是缓存。由于当用户点击"返回"按钮时将重新加载页面,因此您可以检查会话级变量以确定是否显示该页面。这篇文章深入介绍了如何做到这一点

HTH,

Hi,

I need to disable the browser's back button as I am navigating to different pages.

Whenever user submits the data , it should not go back to previous site.

Please help me in this!

解决方案

Hi,

It's not really possible to disable the browser's Back button itself, but there are ways to work around that. 

One method is to use a server-side script to prevent the page from being cached. This forces the browser to go to the server to get the page rather than from the cache. Since the page will be reloaded when the user hits the Back button, you can check a session-level variable to determine whether to display the page or not.  Here's an article that describes in depth how to do this.

HTH,


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

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