禁用退格按钮并在mozilla firefox中刷新. [英] Disabling backspace button and refresh in mozilla firefox.

查看:112
本文介绍了禁用退格按钮并在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.

推荐答案

我昨天回答了一个类似的问题:
仅出于验证目的:
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屋!

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