aspose file tools*
The moose likes JSP and the fly likes back button in mozilla Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "back button in mozilla" Watch "back button in mozilla" New topic
Author

back button in mozilla

Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey freinds i am working on jsp

on logout my back button doesnot work its working perfectly allright means session expire but in mozilla firefox its not working it goes back & need not expires

please help me

thank you
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

May be this helps

http://www.coderanch.com/t/291562/JSP/java/session-invalidate


Swastik
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks

for your reply & immidiate concern but i am facing problem in mozilla & also the post link you have sent is not sufficient sorry for this but guide me further

please

thank you
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Can you show the code of logout, and how you are checking the session in the other page?
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
actually that is being done through struts

& i am not maintaing sessions if you still said me tpo post the code i can

thank you
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

I am not very thorough with struts, but there must be some way to maintain session in struts as well.
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
yes there is a way but i am not using sessions in any of my fom so that i need to invalidate them there can be any other way to solve this porblem

thank you
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

I may be wrong, but I don't think without maintaining a session, the login/logout problem can be handled.
Raghu Chary
Greenhorn

Joined: May 12, 2011
Posts: 9
include this one befor logout page
<script type="text/javascript">
window.history.forward();
function noBack(){ window.history.forward(); }
</script>


and this one in logout jsp



<HEAD>

<script type="text/javascript">
window.history.forward();
function noBack(){ window.history.forward(); }
</script>
</HEAD>
<BODY onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">





</p>
</BODY>
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks for your reply raghu but i am not using any logout.jsp
But i will surely try your first code which i have to includein my jsp's b4 logout

thank you
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 538

If you have invalidated the session once the user logs out, and even still you see the page when you press back button, it is most likely a cached page shown by the browser.. You can change this behaviour by adding the following code to your jsp..
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanku so much Prasad Krishnegowda fro your reply but i have already added these lines on my page

Actually this code works allright for Internet Explorer but for Mozilla it does not work

thank you
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 538

Hi Aditi,
I remember there was a bug in firefox not recognizing no-cache tag..
What version of firefox you are using?
Also see this link http://www.coderanch.com/t/283182/JSP/java/prevent-caching. It may help you
Raghu Chary
Greenhorn

Joined: May 12, 2011
Posts: 9
<HEAD>

<script type="text/javascript">
window.history.forward();
function noBack(){ window.history.forward(); }
</script>
</HEAD>
<BODY onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">



just place this code in logout. jsp and there use send Redirect method in the logout.jsp to redirect to your login page that will solve all the problems
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey Prasad Krishnegowda

thanks for the reply i tried it but also doesnot work by page is still going back after loggingout in Mozilla

help me please

thank you
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey guys its been solved

for references i am copying the single line here else whole code remains same as my previous one

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: back button in mozilla