By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

javascript to disable the REFRESH functionality in a browser

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

Please advise. Thanks!!
Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On 30 Jul 2004 16:34:33 -0700, Matt <jr********@hotmail.com> wrote:
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

--
Michael Winter
Replace ".invalid" with ".uk" to reply
Jul 23 '05 #2

P: n/a
Matt wrote:
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
Jul 23 '05 #3

P: n/a
jr********@hotmail.com (Matt) wrote in message news:<ba**************************@posting.google. com>...
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
Jul 23 '05 #4

P: n/a
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...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5

P: n/a
Glen Spove wrote:
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #6

P: n/a
Glen Spove wrote:
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.
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.