#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7

    Dis-able browser close?


    Well, my project is pretty much a conversion from a Microsoft Access interface. When the user is logged in, they cannot close Access until they close their viewed screens and choose Log Out on the main screen, which brings them back to the login screen and offers the ability to close Access.

    I feel this may not be possible w/ browsers, but perhaps any ideas to achieve similar?


    (This is cross-posted, so I apologize. I figure JS is best for the disabling of items options.)
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,142
    Rep Power
    9398
    Please God no. Fortunately it's not possible, as the most you can do is make the browser confirm that the user does, in fact, want to close the browser after all.

    Is there any technical reason why the user needs to manually close out everything they're doing before they can quit? If all you're doing is replicating the behavior of the Access app then now is a great opportunity to fix what was a stupid feature.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Ya, that I'm tossin around. If I am right, I think the whole thing may be at their main screen, there is a list of employees, and next to each name offers 2 things. 1 is clocked in/out, and the other, which is where this kicks in, is like an "At-desk" type statement. When they are in the site, it is to show they are at their comp, but when browser is closed, they are to be stated more as an "Away from Desk."
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Sorry again for the cross-post. The thought in the PHP side was more of something when user closes the window, or leaves page, javascript may submit something so a server-side PHP can update MySQL or something to state that user as "Away".
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him
  8. #5
  9. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,142
    Rep Power
    9398
    You can totally ping for activity: use Javascript to fire AJAX requests once a minute or so. That'll tell you that the browser window is open. But as for whether that means the user is at their desk...
  10. #6
  11. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,236
    Rep Power
    1469
    Dependent on how you choose to implement this, you might want to take a look at modal dialogs as well.
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Originally Posted by requinix
    You can totally ping for activity: use Javascript to fire AJAX requests once a minute or so. That'll tell you that the browser window is open. But as for whether that means the user is at their desk...
    Nice thought. Well, if they're really at their desk or not, this won't know it any diff than them leaving their Access open either.

    Ok, so JS can fire the AJAX every so often, but that will only note that they ARE at the page. How would I implement something to where if an AJAX DIDN'T get fired, something WOULD happen to note them as away?

    EDIT: The item being set is merely a 0/1 in the MySQL under an "Active" column.
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Originally Posted by Nilpo
    Dependent on how you choose to implement this, you might want to take a look at modal dialogs as well.
    If that's in response to JavaScript, I know next to nothing of this language. Very rarely do I need or use anything of it. Mostly just INPUT box things like calendars and such, or the onclick/onmouseover type things.
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him
  16. #9
  17. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,142
    Rep Power
    9398
    Originally Posted by Triple_Nothing
    Ok, so JS can fire the AJAX every so often, but that will only note that they ARE at the page. How would I implement something to where if an AJAX DIDN'T get fired, something WOULD happen to note them as away?
    You'd have to take the "last active" method: rather than record someone as at their desk or not, record the last time you got a ping from them. Then if the time is within the last 5 minutes (or whatever) then they're at their desk, otherwise they're not.
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    So each AJAX just gets PHP to update the 'Active' column, unless renamed, with the CurrentTime. Then the list of employees window gets built asking something like:
    Code:
    echo 'User is: ' . ($active > $current - 5min ? "At DesK" : "Away");
    Excellent idea. Thank you very much!
    He who knows not and knows not he knows not: he is a fool - shun him. He who knows not and knows he knows not: he is simple - teach him. He who knows and knows not he knows: he is asleep - wake him. He who knows and knows he knows: he is wise - follow him

IMN logo majestic logo threadwatch logo seochat tools logo