File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Again back button wiht logout link 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 "Again back button wiht logout link" Watch "Again back button wiht logout link" New topic
Author

Again back button wiht logout link

Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Hai All,
I have one more problem with that back button again.
Problem is that in our web app pages there is logout link and user can logout from ne page.
Once he is logged out he cannot login again by clicking back button.
I cannot use ne backbutton avoiding logic in web pages as Mr User can logout from any page and some pages amongst them can be accessed by clicking back button.. :roll:
(If i have AK 47 i will shoot guy who got idea of back button )
Pls provide me ne suggestion in this regard.
TIA
Manohar
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
When the user clicks log out, u r removing the session id of the user. so even if the user clcik the back button, the user will be able to see the page again but the user cant click any submit button or go to any other page frm that page.
another option is using a javascript something
<script>
<!--
window.history.forward();
// -->
</script>
OR
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=javascript:history.Forward(1)">
Then another option making the application to open in a new window with out tool bars the still user can rt clcik the mouse
Then finally
It's generally best to design your program around the standards of the web rather than try to change those standards


i havent seen a AK47 so can u plz give that AK47 to me so that i can have look at that.....
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
There are two ways that this is going to have to be done. THe first way is server side. The sever will have to write a varible to each page ad if it is true then the person is able to be there, if false then it would take them to a log in page.
Second is cookies, same as above, but it would not deal with server side code. The best solution would be a session cookie, which expires every time the browser is closed.
Eric
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
Originally posted by Eric Pascarello:
There are two ways that this is going to have to be done. THe first way is server side. The sever will have to write a varible to each page ad if it is true then the person is able to be there, if false then it would take them to a log in page.
Second is cookies, same as above, but it would not deal with server side code. The best solution would be a session cookie, which expires every time the browser is closed.
Eric

session cookies wont get expired when the browser is closed. session cookies will get expired when the user is inactive for 30 min or wat ever time that is set in server.
regarding the variable that has to be set in server that is the session cookies.
correct me if im wrong
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
When all of the browser windows are closed, they get expired too. I know this cause I was testing it last night on a project and that is how I was reseting it to check if it worked.
Eric
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
If my knowledge is correct , session wont get expired when u close the browser unless u have some code to invalidate the session. u can still access that session with the same session id.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Tsession cookies I am dealing with have no contact with the server, the one I am talking about is just client based. Is that what you are talking about?
Eric
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Hai Eric, Sunitha .
Thanks for your suggestions. But my problem still persists as I can't use any of approaches listed in this thread. Here are the reasons.
1. Even if the user clcik the back button, the user will be able to see the page again but the user cant click any submit button or go to any other page frm that page.
This is fine but I am trying to avoid user getting displayed with previous page even though he can't do ne thing.

2. window.history.forward();
3. <META HTTP-EQUIV="Refresh" CONTENT="0; URL=javascript:history.Forward(1)">

I understand this is to be added in previous page but my requirement allows navigating in some pages using back button when he is not yet logged out
Then another option making the application to open in a new window with out tool bars the still user can rt clcik the mouse
Donn have that mucj freedom
4. The sever will have to write a varible to each page ad if it is true then the person is able to be there, if false then it would take them to a log in page.
I am bit confused regarding this tip. As per my understanding back button navigation did not generate ne new request and hence we cannot contact server and ne server side logic is of no use. Correct me if I am wrong

5. The best solution would be a session cookie, which expires every time the browser is closed.
This is bit new to me. If it is server side cookies how this can help to avoid caching page and hence not allowing to user to go back?
If it is client side then if client disabled cookies will this approach helps?
That's all..
Pls suggest ne ideas..
To sunitha
It's generally best to design your program around the standards of the web rather than try to change those standards
This thread begun because we have to go along with standards.
i havent seen a AK47 so can u plz give that AK47 to me so that i can have look at that
Even I donn have one..Ne way..If u wann just to have look @ it ne toy gun will do.
Thanks for all and in advance..
Manohar
hoops I completed
small one
Greenhorn

Joined: Mar 06, 2003
Posts: 1
advice from a novice...correct me if i am wrong
when the user logs out..try to send information of logout through a form (post a form with userid to be logged out)...so if the user hits the back button..he wuld have 2 refresh the page...which wuld ask him to log on again..
HTH
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
Manohar,
In my app i have only the logout link. The users can see the prev page when they click back button of the browser but after that they not able to see any page . but i think if u can make logout as a button then if they click the back button they will get the message" page can not be displayed" same as prev pages( that displaying when the user clicks a button not link) but i havent checked that.
wat "small one said is correct" but users dont have patience to do all that stuff. even logout button also only some users click logout.
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Thanks once again...
when the user logs out..try to send information of logout through a form (post a form with userid to be logged out)...so if the user hits the back button..he wuld have 2 refresh the page...which wuld ask him to log on again..
I am not sure about this...
Consider this scenario...
page1 is having logout link with URL=url1 containing logout form post stuff...
Also page1 is displayed as a result of url0.
Now my logout page is displayed because of url1 and If i hit back page corresponding to url0 will be retrieved and i am not sure regarding how refresh of page takes place.
Manohar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Again back button wiht logout link