javascript to disable the REFRESH functionality in a browser

M

Matt

By using javascript, is it possible to disable the REFRESH
functionality (F5 or refresh icon) in a browser?

Please advise. Thanks!!
 
S

Spartanicus

By using javascript, is it possible to disable the REFRESH
functionality (F5 or refresh icon) in a browser?
No.

Please advise.

Why do you want to such a silly thing?
 
R

rf

Matt said:
By using javascript, is it possible to disable the REFRESH
functionality (F5 or refresh icon) in a browser?

Please advise. Thanks!!

Where shall I advise? Here or over at com.lang.javascript?

You have so far wasted one persons time, in that you have two identical
answers in two seperate newsgroups.

Are you ever going to learn how to post? I thought not. You probably don't
even read these replies.
 
Joined
Dec 5, 2008
Messages
1
Reaction score
0
It is possible to stop page refresh using javascript.

Hi Matt,
It is possible to stop page refresh using javascript.
All that you have to do is just copy this piece of code in your <HEAD> tag of HTML page (or where you have your other javascript functions).
function showKeyCode(e)
{
//alert("Inside function showKeyCode(e)");
var keycode =(window.event) ? event.keyCode : e.keyCode;

if(keycode == 116)
{
event.keyCode = 0;
event.returnValue = false;
return false;
}
}

And call this function on onKeyDown event in your <BODY> tag.
I have used this code and have been successfuly to stop the page refresh.

Enjoy!!!!!
 
Joined
Sep 21, 2010
Messages
1
Reaction score
0
Dear amod_ranade,
i am trying to use your procedure but it's not working .
so can you tell me what's the wrong with me?

Code:
 inside the HEAD section:

<script type="text/javascript">
function showKeyCode(e)
{
alert("Inside function showKeyCode(e)");
var keycode =(window.event) ? event.keyCode : e.keyCode;

if(keycode == 116)
{
event.keyCode = 0;
event.returnValue = false;
return false;
}
}
</script>

With Body section

<body  onKeyDown ="showKeyCode();">


amod_ranade said:
Hi Matt,
It is possible to stop page refresh using javascript.
All that you have to do is just copy this piece of code in your <HEAD> tag of HTML page (or where you have your other javascript functions).
function showKeyCode(e)
{
//alert("Inside function showKeyCode(e)");
var keycode =(window.event) ? event.keyCode : e.keyCode;

if(keycode == 116)
{
event.keyCode = 0;
event.returnValue = false;
return false;
}
}

And call this function on onKeyDown event in your <BODY> tag.
I have used this code and have been successfuly to stop the page refresh.

Enjoy!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top