Timeout Issues

JavaScript related questions should go here.
Post Reply
wrichards8
Posts: 66
Joined: Thu Jan 12, 2012 3:54 pm
Contact:

Timeout Issues

Post by wrichards8 »

Hi all,

I am trying to code a javascript timeout for my website so the user doesn't have their session taken away without warning, The code I have is:
[syntax=javascript]function delay()
{
window.location = "logout";
}

[/syntax]

I also have [syntax=xhtml]<body onload="setTimeout(delay(), 300000);">[/syntax]

My problem is that, when the user page loads, the user is instantly taken to the logout script, instead of after (300000 milliseconds). I'm guessing it has to do with body onload but I would have thought it'd wait. Works fine on my local machine during testing but I put it on the web and it goes screwy. Can someone help?
Post Reply