File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes How to Disable Refresh Button In Browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to Disable Refresh Button In Browser" Watch "How to Disable Refresh Button In Browser" New topic

How to Disable Refresh Button In Browser

Bibhishan Karadkar

Joined: Oct 03, 2001
Posts: 10
How to Disable Refresh Button In Browser
> I can disable right click so from popup menu User cannot select Refresh
> I can Detect F5 key with key event & can Disable
Now remaining two options to user are
1) Refresh Button from Toolbar
2) Refresh option from View pooldown menu
Please can anyone help me out
Thanks ,
Bibhishan .
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Open a pop up window with out the menu bar and the tool bar.
that is the only way to do it....

If you need help with the pop up window, I have a generator on my site.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

... but don't rely on this as a perfect solution, it is still only a work-around. If the user is used to refreshing by using keyboard commands (like I do) they will still be able to reload the page.
Feign Narula

Joined: Apr 19, 2004
Posts: 1
Hi guys the only way I know is that if u want to disable the refresh button you can by using the ActiveXObject(...) and fiddling with the clients registry. I hope if there is any way in which I can mask the values in the registry temporarily on the client so that I can disable for a particular window.
As far as I know every window has a ClsId and the ActiveXObject can be called for that particular window instance and the button can be disabled. that is ms operating systems. What would happen if I am on linux or solaris. I think the story with linux and solaris would change.
The back button as I tried in jsp can be locked by calling location.replace(url) method as history.current becomes equal to history.previous.
I also think that the refresh button depends on cache so I tried the followindg code but in vain....
response.setHeader("Cache-Control", "no-store") //HTTP1.1
response.setDateHeader("Expires", 0);
but the curren window cache cannot be empty. I am trying some new methods as well. If I am successful I will do inform you.

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
only way to block it is to expire the page as said before....
I agree. Here's the link:
subject: How to Disable Refresh Button In Browser
It's not a secret anymore!