This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disabling Back Button in a browser

 
Raja Rama
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's a nice share Steven, I could also use that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic