Redirect unless javascript events?

T

turnitup

Dear all,

I would like to implement a session timeout feature so that browsers are
automatically logged out if there is no activity after a certain time.

I know that this can be done with javascript or the meta tag. But I have
a "sovereign" application written using AJAX which does not require a
page refresh, but should continue to behave as though it had been refreshed.

Is there any code which can detect javascript events and reset any
timeout timer?

TIA
 
E

Evertjan.

turnitup wrote on 30 aug 2006 in comp.lang.javascript:
Dear all,

I would like to implement a session timeout feature so that browsers
are automatically logged out if there is no activity after a certain
time.

What is "logged out browsers"??

Is being logged in not a serverside session thing?
I know that this can be done with javascript

With serverside javascript certainly!
or the meta tag.

Log out?
But I
have a "sovereign" application written using AJAX which does not
require a page refresh, but should continue to behave as though it had
been refreshed.

Show us code, if you wish to discuss it.
Is there any code which can detect javascript events and reset any
timeout timer?

Has this to do with the text above?
 
T

turnitup

Evertjan. said:
turnitup wrote on 30 aug 2006 in comp.lang.javascript:


What is "logged out browsers"??

What I mean is redirected to a logout page. I should have been clearer.
Is being logged in not a serverside session thing?
Yes, by being redirected to a logout page!
With serverside javascript certainly!


Log out?

I meant redirected to logout page.
Show us code, if you wish to discuss it.

There are lots of events which talk via an Ajax library to the server.
 
E

Evertjan.

turnitup wrote on 30 aug 2006 in comp.lang.javascript:
What I mean is redirected to a logout page. I should have been
clearer.

Yes, by being redirected to a logout page!

Why would you want to do that?
Surely if the user is not using the window for an extended time,
he/she probably will not see the logout page?

It should be much simpler to serverside transfer to the login page,
If the session has timed out serverside and the user tries to do an
action from the last page he was on?

What is the functionality of a "logout page"?
Saying "You are logged out"?
There are lots of events which talk via an Ajax library to the server.

Yes, however you were talking about your application.

So you want, I presume, have Ajax ask the server at certain intervals if
the session still exists, and if not, change the page to a page saying
"You are logged out" without redirecting to it?

That seems not that difficult.
Is it useful?
 
T

turnitup

Evertjan. said:
So you want, I presume, have Ajax ask the server at certain intervals if
the session still exists, and if not, change the page to a page saying
"You are logged out" without redirecting to it?

That seems not that difficult.
Is it useful?
OK, let me explain!

Basically, if a user leaves their terminal unattended, I want to
redirect the page to a page which they will log them out.

I can do this using javascript, and an onload timer. But I want this
timer to be reset on any javascript event.
 
E

Evertjan.

turnitup wrote on 30 aug 2006 in comp.lang.javascript:
OK, let me explain!

Basically, if a user leaves their terminal unattended, I want to
redirect the page to a page which they will log them out.

"a page which they will log them out"

Who will log whom out?
I can do this using javascript, and an onload timer. But I want this
timer to be reset on any javascript event.

onload = "var myTimer = window.setTimeout(...,..)"

function resetMyTimer(){
window.clearTimeout(myTimer)
myTimer = window.setTimeout(...,..)
}
 
R

RobG

turnitup said:
Dear all,

I would like to implement a session timeout feature so that browsers are
automatically logged out if there is no activity after a certain time.

I know that this can be done with javascript or the meta tag. But I have
a "sovereign" application written using AJAX which does not require a
page refresh, but should continue to behave as though it had been refreshed.

Is there any code which can detect javascript events and reset any
timeout timer?

That is normally done server side and is based on interaction with the
server, not events on the client. If a user doesn't interact with the
server for a time, their session times out and whatever they do after
that will be re-directed to a "your session timed out" page.

On the client, you can't tell whether the user is still interacting
with the page or not. Even if you trap say onclick, onkeypress and
onscroll at the document level, how do you know that users aren't using
some client-side technology to make those events occur, rather than
actually interacting with the page?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top