wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Disable 'Back' and 'Reload' buttons of Browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disable Watch "Disable New topic
Author

Disable 'Back' and 'Reload' buttons of Browser

Balki Dhar
Greenhorn

Joined: Dec 15, 2005
Posts: 18
Hi
Anybody knows how to disable the 'Back' and 'Reload' buttons.
dbalki
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
You can't do it I'm afraid! You cannot change browser functionality! It's a real pain, but I've never found a way round it!


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Angela is right. Can't do it. Best bet is to use a popup window and hide the menubar,toolbar,etc... But someone can still right click on your page and reload it, or hit CTRL-R or F4 in the browsers.
Sorry about that.
Balki Dhar
Greenhorn

Joined: Dec 15, 2005
Posts: 18
Hi Angela and Bill
Thank you very much. I will try to popup a window without toolbar for my application.
dbalki
henrie
Greenhorn

Joined: Oct 13, 2000
Posts: 1
I'm using this code to disable the right mouse button:
<script language="JavaScript">
var SealoffSource = true; /* to disable the right mouse button, so the source can not been seen. */
function click() {if (event.button==2) {alert('The source is sealed off..')}}
document.onmousedown=click;
</script>
H.
Mindy Walker
Greenhorn

Joined: Mar 31, 2000
Posts: 20
If your page is displaying in a pop-up/daughter window, you can hide the button bar.
Here is some excellent code that works very well in both Netscape and IE:
Place this code within your HEAD tags:
<script language="JavaScript">
<!-- Begin pop-up window code
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'width=600,height=338,menubar=no,toolbar=no,location=no,scrollbars=no,status=no,resizable=yes,');");
}
// End pop-up window code -->
</script>
The "menubar=no,toolbar=no,location=no,scrollbars=no,status=no,resizable=yes" defines which features you would like the browser to use.
This is the link code calling JavaScript:
<a href="javascript :popUp(your_filename.html')">Click here so you can't use your back button!</a>
Have a splendiferous day!
Mindy
[This message has been edited by Mindy Walker (edited October 25, 2000).]


Matt's, The Java Geek, better-half. :~D
praveenpr
Greenhorn

Joined: Sep 28, 2001
Posts: 1
It is not possible to fiddle the toolbar buttons......however the back button can be indirectly disable by not allowing the history to go more than 1.
Reda Mokrane
Ranch Hand

Joined: Jul 25, 2001
Posts: 237
Hi,
To make the back button hard ... try this snnipet
<SCRIPT LANGUAGE="JavaScript">
javascript:window.history.forward(1);
</SCRIPT>

Originally posted by praveenpr:
It is not possible to fiddle the toolbar buttons......however the back button can be indirectly disable by not allowing the history to go more than 1.

Toshit Bhardwaj
Greenhorn

Joined: Jun 13, 2002
Posts: 2
Well..you can't actually disable back button but you can prevent it going back ..by using javascripts history.forward function..
Okay so ..when you logged off from page 1 and wants to goto page 3...take page 2 as middle page ...instead of going to page 3 directly ..go via page 2...
your page 2 will redirect to page3 and will be having javascript history.forward function..
here is the code
you need to put in page2
<script language="javascript">
window.location="page3.html"
window.history.forward(2);
</script>

and that's the solution for your problem...


Toshit Bhardwaj<br /> Web Development Manager<br /> Australia<br />Web : <a href="http://www.australiandesi.com" target="_blank" rel="nofollow">http://www.australiandesi.com</a>
 
jQuery in Action, 2nd edition
 
subject: Disable 'Back' and 'Reload' buttons of Browser
 
Similar Threads
reload the jsp page
Disable browser buttons
How to disable the Back and Refresh functionalities?
To Disable Back button in all the browsers
Disabling Back and Refresh/Reload button.