473,569 Members | 2,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How disable the F5 key in Mozilla

Hi,
I am trying to disable the F5 key in Mozilla. I have the next code in
javascript that it is working in Internet Explorer but it is not
working in Mozilla. how can I disable the F5 key in Mozilla?

<script>
document.onkeyd own = function(){

if(window.event && window.event.ke yCode == 116){
window.event.ke yCode = 505;
}
if(window.event && window.event.ke yCode == 505){
return false;
}

}

</script>

May 24 '06 #1
7 17951
You can find very simple solutions here:
http://www.gklein.org/tests/js/disablekey.html

May 24 '06 #2
On 24/05/2006 12:18, prado wrote:
I am trying to disable the F5 key in Mozilla.


Well, stop that then and fix the real problem, instead.

If refreshing breaks something, then attempting to prevent that action
doesn't fix anything. More importantly, you'll never really succeed:
there are other means besides F5, including other keystrokes, and it
will clearly do nothing for users with scripting disabled.

Finally, have you thought the consequences through properly? If a
document doesn't load completely due to network problems, but sufficient
data comes through to disable refreshing, what do you think the user
will do if they can't reload?

[snip]

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
May 24 '06 #3
I can not disable F5 key in Mozilla. I have tried it but it don't work.
Can you help me, please?

Jun 2 '06 #4
prado said the following on 6/2/2006 8:27 AM:
I can not disable F5 key in Mozilla.
Good.
I have tried it but it don't work.
And that is how it should be.
Can you help me, please?


Redesign your app so that F5 doesn't fubar it.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 2 '06 #5
VK

prado wrote:
I can not disable F5 key in Mozilla. I have tried it but it don't work.
Can you help me, please?


The linked solution does work - unfortunately - even for the latest FF
1.5.0.4
Today later I'll file a bug to bugzilla so they fix it (unless there
are volunteers to do it immediately ?)

Jun 2 '06 #6
VK said the following on 6/2/2006 3:46 PM:
prado wrote:
I can not disable F5 key in Mozilla. I have tried it but it don't work.
Can you help me, please?
The linked solution does work - unfortunately - even for the latest FF
1.5.0.4


No, it does not "work" at all.
Today later I'll file a bug to bugzilla so they fix it (unless there
are volunteers to do it immediately ?)


To fix what? The ineptness of webpage authors that can't write a decent
app that won't die if the F5 key is pressed? Good luck with that but I
don't think filing with bugzilla can fix that problem.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 2 '06 #7
teppei
1 New Member
Randy Webb & Michael Winter,
I think you are too close minded...

To disable the F5 key doesn't necessarily mean that
the programmer can't solve a "refresh issue".

e.g.
I'm moving a "mainframe application" to a web application.
I don't want the users to change their way of working...
They are used to:
- press F1 to inqury
- press F2 to insert
- press F3 to update
- press F4 to delete
- press F5 to release
....

As you can see I need to intercept the function keys and to
change their functionality.

--------------------------------------------

Back to the topic...

This is what I've done:

/*
* Intercept all the 'function keys' and invokes the related submit input
* (if one exists). This method must be invoked when a "keydown" event occurs
*/
function interceptKeyDow n(e) {

keyCode = e.keyCode;

if( keyCode >= asciiF1 && keyCode <= asciiF12 ||
keyCode >= asciiPgUp && keyCode <= asciiHome ) {

e.keyCode = 505;
clickButton( keyCode );
return false;
}
}
attachEventList ener(document," keydown",interc eptKeyDown,true );

/*
* Intercept all the 'function keys' and invokes the related submit input
* (if one exists). This method must be invoked when a "keypress" event occurs
*/
function interceptKeyPre ss(e) {[indent]
if( !e ) {

if( window.event ) e = window.event;
else return;
}

//NS 4, NS 6+, Mozilla 0.9+, Opera
if( typeof( e.which ) == 'number' ) {

var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : void 0;

if(e.charCode == null || e.charCode == 0 ){

if( keyCode >= asciiF1 && keyCode <= asciiF12 ||
keyCode >= asciiPgUp && keyCode <= asciiHome ) {

e.stopPropagati on();
e.preventDefaul t();
clickButton( keyCode );
}
}
}
}
attachEventList ener(document," keypress",inter ceptKeyPress,tr ue);


/*
* According to the type of browser, adds a new event listener to
* the specified object ,for the requested event, binded to the
* specific function.
*/
function attachEventList ener( obj, type, func, capture ) {

if(window.addEv entListener){ // Mozilla, Netscape, Firefox

obj.addEventLis tener( type, func, capture );
} else { // IE

obj.attachEvent ( 'on' + type, func );
}
}


the function clickButton( keyCode ) changes according to your specifications
Jun 9 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2661
by: Kate Riley | last post by:
Hi all - Thanks in advance for your help. I am using IE 6 and NN7. I was testing the <NOSCRIPT></NOSCRIPT>, so I was trying to turn off or disable JavaScript in my browsers. But in my "Internet Options" and "Preferences", respectively, I am unable to find the option to disable JavaScript. Is disabling JavaScript in IE6 and NN7 no...
1
29209
by: Prashant Joshi | last post by:
Hi all, I am using javascript to open a popup window. Is there any way we can disable the minimize button in this window? The maximize button is disabled. I want the same for the minimize button. Here is the javascript code that opens the window : child = window.open('NewWindow.aspx', null, 'width=850, height=450, directories=no,...
3
16522
by: David Rwj Cherry CS2000 | last post by:
is there any way to disable or lock vertical scroll bars on a browser window? im a newbie and i just don't want them to appear on my screen. sometimes they appear on IE but not on mozilla. any ideas would be most appreciated.
18
9941
by: no | last post by:
Is there any way to disable the saved form information Mozilla Firefox and Internet Explorer presents in a list every time you type text in a form input, on a page you use every day? If so, what is the correct syntax for the CSS? Thanks.
11
3272
by: MasonC | last post by:
I find I cannot disable javascript in MSIE 6 I've Help'd, Google'd, and searched here to no avail. <noscript> You don't have javascript enabled </noscript> will not display for me. Mason C
6
66101
by: Matt | last post by:
I want to disable the title bar, status bar and address bar of a window, but I couldn't find the syntax. I tried the following but not working. any ideas?? window.document.statusbar.enable = false; window.document.titlebar.enable = false; window.document.addressbar.enable = false; <html> <title>hey</title>
2
4575
by: Eli | last post by:
Hi, Since using IFRAMEs in my page, I want to disable the F5 and BackSpace keys. I got this working on IE but not on Mozilla Firefox: function CheckKey(evt) { evt=(evt)?evt:window.event; switch (evt.keyCode)
6
9065
by: Al Cohen | last post by:
I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed. I'd like to disable my LinkButton during this period to prevent multiple submissions. (Obviously) the disabling should be done at the client side to prevent any delay. I've...
8
5410
by: alamodgal | last post by:
hiiiiiiiiiii everybody, pls solve my problem if u can? Actualy what happens in my site when i press enter key it will show some secured information related to my site.So for that i have use this code to disable enter key: <script type="text/javascript" language="javascript"> ...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7682
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3663
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3655
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
954
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.