Forum OpenACS Q&A: closing window on logout

Collapse
Posted by David Kuczek on
How can I automatically close the browser window when somebody logs out?

At the moment the user is redirected to either "return_url" or "/"
from /register/logout.tcl...

Collapse
Posted by Simon Carstensen on
You should redirect to "closewindow.html" holding the following script in the header:

<script>
t = null;
function closeMe(){
t = setTimeout("self.close()",0);
}
</script>

But I don't see why you'd want that, unless you are handling the log-out in a pop-up, which I can't see why you'd want, either :)

Collapse
Posted by David Kuczek on
Hello Simon,

thanks for the suggestion...

you are right... I am handling a specific not the normal logout in a pop-up!

Collapse
Posted by Simon Carstensen on
Hm, this should suffice for just closing the window:

<script>
self.close
</script>

Don't know why I would put a timeout around it.

Im using Acs 4.2 and a novice using tcl

Looking at
/web/servername/packages/acs-subsite/www/register
vi logout.tcl
where exactly do I put the


self.close script


The code looks like this
# /www/register/logout.tcl

ad_page_contract {
Logs a user out
@cvs-id $Id: logout.tcl,v 1.2 2000/09/19 07:24:19 ron Exp $
} {

}
ad_user_logout
db_release_unused_handles

ad_returnredirect "/"

I do not want to use a pop up window
Collapse
Posted by Simon Carstensen on
Change ad_returnredirect "/" to ad_returnredirect "closewindow.html" and then put the script in closewindow.html between <head></head> and add onload="closeMe();" to <body>
Collapse
Posted by Armando Arroyo on
Thanks, you pointed me in the right direction.
I was anble to implament a script to force close out upon clicking the proper link with a few minor adjustments.