禁用退格按钮并在mozilla firefox中刷新. [英] Disabling backspace button and refresh in mozilla firefox.
本文介绍了禁用退格按钮并在mozilla firefox中刷新.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
我想禁用退格按钮.我使用了以下代码.在IE中,它可以工作,但在Firefox中.
代码段:
I want to disable the backspace button. I used the following code. In IE it is working,but in Firefox.
Code Snippet:
if(event.keyCode == 8)
{
return false;
}
然后,我使用了以下代码,它可以工作,但是页面令人耳目一新.我还需要禁用刷新.
Then I used the following code, it is working but the page s refreshing. I also need to disable the refresh.
function noBack()
{
window.history.forward()
}
noBack();
window.onload = noBack;
window.onpageshow = function(evt)
{
if (evt.persisted)
noBack()
}
window.onunload = function()
{
void (0)
}
请帮我解决这个问题.
Pls help me to overcome this issue.
推荐答案
我昨天回答了一个类似的问题: ^ ]
您无法100%处理浏览器的后退按钮或刷新按钮.有多种方法和方案可以触发它们中的任何一个.
相反,您的设计/实现应不受此类干扰的影响.
在这种情况下,如果使用计时器,则如果计时器在客户端,则刷新将重置它.您需要添加一些逻辑来跟踪服务器端的时间并进行验证.如果发生刷新,请进行处理.进一步,在红色消息上显示不要刷新",否则将丢失一些内容;)
仅出于验证目的:
ASP.Net中的刷新页面问题 [提交请求后,请刷新 [检测页面刷新 [
I replied to a similar question yesterday: prevent browser backbutton[^]
You cannot handle browsers back button or refresh button 100%. There are multiple ways and scenario that can trigger either of them.
Instead, your design/implementation should be such that it is not affected by such interferences.
Here, in case of timer, refresh would reset it if the timer is on client side. You need to put some logic to track time on server side and validate it. Handle refresh occurance if it happens. Further, put a red message and display it to user that ''DO NOT REFRESH'' or you will loose something ;)
Just for validation purpose:
Refresh Page Issue in ASP.Net[^]
Stop Refresh after Submitting your Request[^]
Detecting Page Refresh[^]
这篇关于禁用退格按钮并在mozilla firefox中刷新.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文