Daniel H
Daniel H

Reputation: 2925

Javascript inactivity timeout monitor

I am trying to implement an inactivity timeout monitor into my page so that when people are working from home, we can see whether they are actually at their desk or not.

I'm using this Jquery plugin http://plugins.jquery.com/project/timeout which sets a timer running when the page is loaded, and if no ajax calls have been made within 30 seconds then it displays an alert message. This is the alert message:

else {
            alert('Session timed out.');
            T.reload();
        }

I need to add some extra onto this so that if this alert button isn't pressed within 5 minutes, it will notify the head office in some way that the user isn't active. How would I add another timer & function into there?

Thanks for any help

Upvotes: 0

Views: 958

Answers (2)

DarthJDG
DarthJDG

Reputation: 16591

You can't, javascript alert() is blocking all scripts and input until they are dismissed. To do what you want, have a look at jQuery UI Dialog, or show your message as part of the DOM yourself.

Upvotes: 1

de3
de3

Reputation: 2000

Instead of using 'alert', you can show a layer ('div') with a button listening to an 'onclick' event, so you'll be able to know when did the user press the button.

Upvotes: 0

Related Questions