Solved

How can I capture in javascript ctrl-R or F5?

Posted on 2002-04-02
7
4,326 Views
Last Modified: 2007-12-19
Anuone has any code available of capturing the How can I capture in javascript ctrl-R or F5 key.

Thanks
Nesifa
0
Comment
Question by:nesifa
7 Comments
 
LVL 20

Accepted Solution

by:
jitganguly earned 30 total points
ID: 6913532
116 is the number. but it does not work with ctrl+R
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getKey(keyStroke) {
isNetscape=(document.layers);
eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;

if (eventChooser==116)
alert("Please don't press f5");

}
document.onkeydown = getKey;
// -->
</SCRIPT>
</HEAD>
<BODY>
Press a key to see the ascii code.
</BODY>
</HTML>
0
 
LVL 5

Expert Comment

by:kcm76
ID: 6913590
HI GANGULY
IT's working even for CTRL+R

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getKey(keyStroke) {
isNetscape=(document.layers);
eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;

if (eventChooser==116)
     alert("Please don't press f5");
if (event.ctrlKey)
     {
     if(eventChooser==82) alert("CTRL+R");
     }

}
document.onkeydown = getKey;
// -->
</SCRIPT>
</HEAD>
<BODY>
Press a key to see the ascii code.
</BODY>
</HTML>

KCM
0
 
LVL 3

Expert Comment

by:tejaspurani
ID: 6914075
still not disabling the F5 Function. can u do that?

TP
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 5

Expert Comment

by:kcm76
ID: 6914087
U cannot disable (built-in features) F1 - help, F3 - find, F4 - drop down address list - and so on.

KCM


0
 

Expert Comment

by:viapek
ID: 6914866
If you want to stop the refresh, add return false. This should stop it.

Ova
0
 
LVL 3

Expert Comment

by:tejaspurani
ID: 6915958
Viapek,

No it's not !!!!

TP
0
 

Author Comment

by:nesifa
ID: 6921759
You are the first and everybody else played with your original code. You deserve it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now