Timer function

I’m trying to set up some functionality whereby if there is no activity on an open page from my website for a certain period of time then the page automatically locks itself and requests a password. I don’t think there is any timer functionality in any of the containers but could I use the HTML .setinterval method from within say Layout or Window components?

Alternately has anybody else come up with another way of doing this?

Thanks in advance.



hmm… you need something like:

var tm = null; // this is temeout variable

// this function will triggered each time ahen user do something
// that may consider valid action
// this will clear current timer and launch the new one
function wasAction() {
tm = window.setTimeout(lockPage, 480000); // 480,000 = 8 mins
// if no action was due 8 min, launch lockPage function
function lockPage(){
// your code here

i.e. when user will do nothing for example 6 min, then do valid action,
current 6-mins timer will cleared and new 8-mins timer launched.

Thanks Andrei that looks exactly like what I need. Can I use this from within a dHTMLX layout or window or does it only relate to an ordinary web page?

You may use it anywhere you need, page content does not affect on suggested solution.
(Only if this content do not have any “lockPage()” destructive codelines).