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!!
 
M

Michael Winter

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

Please advise. Thanks!!

Happy to be of service. :)

Mike
 
T

Thomas 'PointedEars' Lahn

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

No. Besides, I use Ctrl(+Shift)+R for refresh in my Mozilla Firefox.
Please advise. Thanks!!

Revise your Web application. You're welcome, though this question has
been asked too much.


PointedEars
 
R

Robert

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

Why would you want to do this?

You cannot do this on the client. You could implement it on the
server by detecting a refresh and not doing the refresh. Don't ask me
how it is done, but I have seen it done on my local library book
renewal page. The library server program won't let me refresh the
page were I have the list of books checked out. The program forces me
to reenter my password before it will let me see my list of books.

Please advise. Thanks!!

Robert
 
G

Glen Spove

Yes it is possible.

In a function capturing onkeydown, type:

event.keyCode = 0; //or any other number but F5
event.returnValue = false;
return false;



This works...
 
R

Randy Webb

Glen said:
Yes it is possible.

In a function capturing onkeydown, type:

event.keyCode = 0; //or any other number but F5
event.returnValue = false;
return false;

And how, exactly, does that stop me from clicking the Refresh button?
This works...

No it doesn't, you just think it does.
 
R

Richard Cornford

Glen said:
Yes it is possible.

You are referring to something in particular? Maybe the disabling of the
refresh functionality in a web browsers? That is emphatically not
possible. (Hence multiple responses stating as much going uncommented by
others.)
In a function capturing onkeydown, type:

event.keyCode = 0; //or any other number but F5

Apart from the lack of discrimination in attempting to cancel all key
presses instead of just (the many) key sequences that would result in a
refresh action, to the best of my recollection only IE browsers allow
the assignment on values to keyCode events.
event.returnValue = false;
return false;

This works...

You are defining "works" as: works to inhibit only the use of the F5 key
to refresh the page, on javascript enabled default configurations of
Windows IE, but only when key events are passing through the document
(which they don't necessarily have to). The use of such a lax definition
of "works" means that whatever (harmful?) consequences follow from the
user refreshing the page, this script has done little more than reduce
the chances of them happening. So to exactly the extent to which those
consequences are undesirable, this proposal is inadequate.

Normal actions on the part of the client browser such as refreshing a
page, or moving back and forward in the history, or opening another
window showing the same URL (with Ctrl-N on Windows IE) should be
anticipated by the author of a server-side system that is to use a
browser client. They cannot be reliably prevented so instead they need
to be anticipated and accommodated in the design of the server-side
system. Failing to do that would be creating a web application that is
broken by design, and unsurprisingly the normal advice in that case is
to fix the server side.

Richard.
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top