aspose file tools*
The moose likes Servlets and the fly likes Disable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Disable "BACK" button..(urgent)" Watch "Disable "BACK" button..(urgent)" New topic
Author

Disable "BACK" button..(urgent)

Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
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


Malhar Barai
SOA & Java Book
kvk kishore
Greenhorn

Joined: Sep 27, 2001
Posts: 12
Will it be OK if you are not allowed to go to prev. page . Hope you guess the difference .
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
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

Joined: Apr 30, 2001
Posts: 49
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

Joined: Aug 17, 2001
Posts: 399
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

Joined: Sep 27, 2001
Posts: 12
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

Joined: Sep 27, 2001
Posts: 12
Let me give the exact code :
window.history.forward(1);
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
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

Joined: Sep 27, 2001
Posts: 12
DID U TRY THE CODE MENTIONED IN IInd REPLY
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
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

Joined: Jun 07, 2000
Posts: 87
nice and simple trick!
that's great!
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
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


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Syam Veerakumar
Ranch Hand

Joined: Sep 20, 2001
Posts: 49
Hi,
U can get javascripts at www.dynamicdrive.com.
Syam.


A Quitter Never Wins<br />A Winner Never Quits
kvk kishore
Greenhorn

Joined: Sep 27, 2001
Posts: 12
FINE THEN .. AND THANX .
arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
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

Joined: Jun 18, 2001
Posts: 66
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

Joined: Sep 20, 2001
Posts: 49
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

Joined: Sep 27, 2001
Posts: 12
arpita ,
YOU DID NOT MENTION HOW SESSION IS MAINTAINED .. I MEAN USING DATABASE , SESSIONS or ...I can suggest a method if you can respond

 
 
subject: Disable "BACK" button..(urgent)