• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

not to allow closing current window..

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi...
i have this jsp page in which i want to implement a javasrcipt that doesnot allow the user to close that page ..... is there such a java script..!
What i mean is that i want the user to click on the log out button then he will be redirected to another page but i want to restrict the user to close the window manually... how do i do that...??? and on clicking log out button i want the session to invalidate or expire ...how would i control that...!
FOR EG: view_calls.jsp has a log out button..... i want to restrict the user from closing the view_calls.jsp manually...... i have to just redirect this page by clicking the log out button and then expire the session....
Any Suggestions..!!pls help...!
thanxs...!!!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not keep the user from closing the window....
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically, you can either open another window or submit a request to a server, using onunload handler, but that pretty much it.
Besides, what if user turns of a computer?
You should rethink your server side.
Use session timeout setting, seeeion listeners if you need to clean up something when session invalidates and so on.
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i cannot close the current window .. then can u please tell me how i can re-direct to another page when the user clicks the top right button to close the window....!!!
is there a way for it ...!
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
re-direct to another page or open another window...!!!
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use onunload with window.open but doing this will also cause it to open when you submit the form so you need to have a flag to check whether it is submitted or closed....
the X is not the only way to close a window either....
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
eric..
since i'm not that familiar with java script can you please provide a code to carry out the task that you had mentioned in your previous post..!

thanxs..!
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I always say: DO NOT RELY ON JAVASCRIPT SINCE IT CAN BE TURNED OFF. USE SERVER SIDE PROGRAMMING TO FIX YOUR BUGS! You should make your server side handle cancelling sessions with timeouts or something.....
BUT since you asked...
Basic idea:

Eric
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you eric....
it worked....thanxs a lot..!
 
grapes are vegan food pellets. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic