This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disable "BACK" button..(urgent)

 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
is there any way i can disable the browser "BACK" button or can i invalidate a session when the user hits the "BACK" button...
This using Servlets on Apache..
thanx
malhar
 
kvk kishore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will it be OK if you are not allowed to go to prev. page . Hope you guess the difference .
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear
that will b fantastic..
Originally posted by kvk kishore:
Will it be OK if you are not allowed to go to prev. page . Hope you guess the difference .

 
Eric Johnson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could have the page that you don't want the user to go back from be a browser window without a toolbar, but they could still right-click and choose back if they are usin ie on windows. or you could experiment with using javascript to manipulate the history property of the window object.
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear
i m unable to find any particular javascript fr this...is it possible for u to go further n lend me the script if u hv it...or just tell me the URL where i can find it..
in the meantime i m trying to devise it myself..
thanx again
malhar
Originally posted by Eric Johnson:
you could have the page that you don't want the user to go back from be a browser window without a toolbar, but they could still right-click and choose back if they are usin ie on windows. or you could experiment with using javascript to manipulate the history property of the window object.

 
kvk kishore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Yaar I was a bit busy .
To implement what I was mentioning --
In the page which you don't want the user to come back and view
you can write javascript on to the page like -
<script>
window.forward(1);
</script>
you may use print writer or anything you want but put it in Head tag of the page you are building .
If you have any difficulty or need another approach kindly mail be back .
 
kvk kishore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me give the exact code :
window.history.forward(1);
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey buddy
my browser says "object doesnt support this property"
any solutions??
me not good at javascript :-)
so pls help
thanx again
malhar
Originally posted by kvk kishore:
Sorry Yaar I was a bit busy .
To implement what I was mentioning --
In the page which you don't want the user to come back and view
you can write javascript on to the page like -
<script>
window.forward(1);
</script>
you may use print writer or anything you want but put it in Head tag of the page you are building .
If you have any difficulty or need another approach kindly mail be back .

 
kvk kishore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DID U TRY THE CODE MENTIONED IN IInd REPLY
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ye buddy
got it...now its working perfectly...
thanx a lot
malhar
Originally posted by kvk kishore:
DID U TRY THE CODE MENTIONED IN IInd REPLY

 
shilpa kulkarni
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nice and simple trick!
that's great!
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I hope you're not doing that to the general public without a good reason - some type of 2step form process that MUST be completed or similar.
Most visitors dislike it when the site takes control. Forcing them to close the browser etc.
If you disable the back button your telling them "there's only one way outta this page....MY WAY".
But perhaps this is for an intranet app so it's not so drastic.
Bye,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
Syam Veerakumar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
U can get javascripts at www.dynamicdrive.com.
Syam.
 
kvk kishore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FINE THEN .. AND THANX .
 
arpit singla
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing an application, where user logs in and can log out from any page. How can I make sure once the user logs out he is not able to go back to the page from where he logged out.

window.history.forward(1);
This code works when I dont want the user to visit the page where this code is included.
Could anyone help me in that reagrd..
thanks
 
arpit singla
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
slight addition to the above description:
suppose user browses in following manner

L O G O U T
^ ^ ^ ^
| | | |
1 - > 2 - > 3 - > 4 - > 5
from page 1 to 2 to 3 and so on... user could log out from any of the page 1, 2, 3,4 or 5. I want user to go back and forth between pages using back button. But dont want him to go back once user logs out.

please help...
thanks

 
Syam Veerakumar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arpit,
If u r using session in u'r pages it easy to block user once he logged out.Use session.invalidate(JSP) method in u'r logout page.
If its a servlet use instanceName of the session(for Eg:currSess)
currSess.invalidate().
And its always better to post u'r messages in a seperate thread if its different from current thread.
Regards...Syam.
Originally posted by arpit singla:
slight addition to the above description:
suppose user browses in following manner

L O G O U T
^ ^ ^ ^
| | | |
1 - > 2 - > 3 - > 4 - > 5
from page 1 to 2 to 3 and so on... user could log out from any of the page 1, 2, 3,4 or 5. I want user to go back and forth between pages using back button. But dont want him to go back once user logs out.

please help...
thanks


 
kvk kishore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
arpita ,
YOU DID NOT MENTION HOW SESSION IS MAINTAINED .. I MEAN USING DATABASE , SESSIONS or ...I can suggest a method if you can respond

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic