...

View Full Version : Resolved issue with window left open



durangod
10-02-2012, 06:39 PM
Hi, i have a js av messenger and i think what might be happening is that the member logs off but does not close the window. And i think what happens is that the messenger might still be looking for that feed data while the window is still open so once the member logs out it cant get the data because there is no db connection.

Whats going on is that im getting a cant connect to db repeatedly late at night from the messenger in my error log. So i think thats whats happening they are not closing the messenger window when they log out.

I was not sure if this was a php or js question but i think its a bit of both. So let me ask this,

This is not valid coding just trying to wrap my brain around the logic here.

if i put something like:



<?php
if (!db connection)
{ ?>
<script type="text/javascript">
windowname.close();
</script>
<?php } ?>



in the conf file for the db connection would that work to close the window automatically if they forget to?

WolfShade
10-02-2012, 06:44 PM
If the user tries to open the window to log on, that will close the browser before they can log on.

durangod
10-02-2012, 06:51 PM
Yep it sure will, good thinking. :thumbsup: I didnt consider that... mmmmmm :confused:

Ok what i might do is add something to my logoff routine for the site that when they log off it closes that window

i can just use js


windowname.close();

correct?

WolfShade
10-02-2012, 07:19 PM
Yes, although some browsers will ask permission from the user before actually closing. If the user says NO, the browser will remain open.

You could do that PLUS an alert message (if the user leaves it open) that says the window MUST be closed, or the site cannot perform nightly maintenance. Just a thought.

durangod
10-02-2012, 10:56 PM
that is a great idea. i might just put an alert like what is on this site that when they log of i can alert "please close all windows"

thanks for the help.. :)

durangod
10-03-2012, 01:06 AM
Yep just used this in my header for the logout link and we will see how it goes. thanks again



<a href="logoff.php" onClick="return confirm('Please close Chat-Messenger-Shoutbox Windows! Press OK to log off?');">logout</a>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum