Solved

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

Posted on 2002-04-02
7
4,576 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

705 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