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...!!!
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.
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....