Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,486
    Thanks
    279
    Thanked 32 Times in 31 Posts

    issue with window left open

    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:

    Code:
    <?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?
    Last edited by durangod; 10-03-2012 at 02:12 AM.

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    If the user tries to open the window to log on, that will close the browser before they can log on.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,486
    Thanks
    279
    Thanked 32 Times in 31 Posts
    Yep it sure will, good thinking. I didnt consider that... mmmmmm

    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

    Code:
    windowname.close();
    correct?
    Last edited by durangod; 10-02-2012 at 06:54 PM.

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • Users who have thanked WolfShade for this post:

    durangod (10-02-2012)

  • #5
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,486
    Thanks
    279
    Thanked 32 Times in 31 Posts
    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..

  • #6
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,486
    Thanks
    279
    Thanked 32 Times in 31 Posts
    Yep just used this in my header for the logout link and we will see how it goes. thanks again

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •