473,698 Members | 2,051 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 17968
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
2665
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 longer an option?
1
29246
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, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no, directories=no');
3
16532
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
9954
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
3295
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
66133
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
4579
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
9071
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 tried adding some javascript to LinkButton.Attributes: LinkButton1.Attributes.Add("onclick",...
8
5424
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"> /*-----script to disable F5 key begin-----*/ var version = navigator.appVersion; function...
0
8598
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9152
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9016
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8856
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6515
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4613
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.