permaculture playing cards*
The moose likes HTML, CSS and JavaScript and the fly likes Disabling Back Button in a 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 "Disabling Back Button in a browser" Watch "Disabling Back Button in a browser" New topic
Author

Disabling Back Button in a browser

Raja Rama
Greenhorn

Joined: Dec 19, 2002
Posts: 2
Hi all,
I want to disable the back button in my browser. I have included the following in my code.
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("expires",0);
response.setHeader("expires","0");
response.setHeader("Cache-Control","no-store");
But it does not help me. Kindly anyone let me know how I achieve both the Back button in the browser and also the right click.
Thank you in advance.
Regards,
A.Charles. isaac_charles@rediffmail.com
Dave Comeau
Greenhorn

Joined: Jun 14, 2002
Posts: 27
What is your goal in removing browser functionality?
There are lots of tricks and hacks to "disable" the back button, try a search on google.
None of them are elegant or user friendly.
I would suggest you re-think the structure of the page you are trying to prevent people from returning to. Sessions seem to work well for me.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

also, if you search for "disable back" in this forum -- you'll find about 2 dozen posts on the topic. Enjoy!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
http://www10.brinkster.com/A1ien51/basics/backbutton.htm
right click is useless!! a right click script also blocks users that have their mouse set up for left handed......
If you are trying to protect anything...do not do it...useless.....javascript..html...opensource...not microsoft.....
Steven Lyner
Greenhorn

Joined: Jul 02, 2001
Posts: 10
I had the same problem and I found this code on the net.
<SCRIPT LANGUAGE="JavaScript">
<!--
history.go(1);
//-->
</script>
I put it between the <head> and </head> tags of the page I wanted not to be displayed.
Steve
boyet silverio
Ranch Hand

Joined: Aug 28, 2002
Posts: 173
that's a nice share Steven, I could also use that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disabling Back Button in a browser
 
Similar Threads
how to avoid caching
Making a page expire
Disabling Back Button in a browser
Struts 2 - logout - prevent back button
How to disable web browser history and back buttons