Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

macking backward button false in browser window

 
Amar Deep Singh Chaudhary
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers !
i have created a login page in jsp and verify this login through a servlet.if login is successfull then it is redirects to another jsp.i have a problem when the new jsp is displayed then if i press the backward button of the browser then it comes on the login page.i want to create the application such that the back button of the browser not work to direct to the login page.i want to make that the back button of the browser is appear as disable.Please help me to make the disable the back button of the browser.
[ April 08, 2007: Message edited by: Bear Bibeault ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34378
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amar,
You cannot disable the back button in the user's browser.

You can set the page to "no cache" and display a different page if they choose to refresh it.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Topic Title: "Making backward button false in browser window"
My Question: "Is the button really backward that we need to make it false?"

Just kiddin.

Agreed with Jeanne.
 
Amar Deep Singh Chaudhary
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers !
is anybody help me to making a page with no cache please give me some code example.it's urgent for me.
thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things to read:

First, see:
EaseUp to find out why adding the word "urgent" to your post or subject line can actually slow down or stop responses to your question altogether

Second, Have a look at our JSP Faq:
http://faq.javaranch.com/view?JspFaq
There, you will find a section devoted to showing you how to add no-cache directives to your pages.
 
Min Huang
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put



at the top of your page, it will attempt to go forward a page in your history. If you go to another page, and then try to click back and go to this page, you will be bounced forward.

As an aside, if you do this, people will hate you. True story.

You probably want to use a servlet Filter to make the user go to the right page after authentication. Or use Acegi and let it do the hard work for you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Min Huang:
As an aside, if you do this, people will hate you. True story.


Yes, there's nothing like really annoying your user base with browser tricks that don't serve any real purpose to engender loyalty.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Min Huang:

As an aside, if you do this, people will hate you. True story.



Heh.

I started playing with this idea a while back.
I had read something similar a long time ago but couldn't find a link to it.
I never added a link for this one to any of the FAQ pages because I could never get it to sound "friendly" enough for JavaRanch.

Maybe somebody else can.
http://faq.javaranch.com/view?InterfaceDesignersRule1
 
Amar Deep Singh Chaudhary
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers ! i want to use this java script function in my jsp page javascript:history.back().how i should use this function so that if any one want to go to back page i can invalidate my session.please give me some code example.so that as the user clicks on the backward button of the browser the session can be expired.Thanks in Advance.
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Amar,

Please visit to this URL

http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html

or

http://www.javaworld.com/javaworld/jw-10-2006/jw-1006-logout.html

I guess this will help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic