By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Redirect unless javascript events?

P: n/a
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
Aug 30 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 30 '06 #2

P: n/a
Evertjan. wrote:
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"??
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!
>I know that this can be done with javascript

With serverside javascript certainly!
>or the meta tag.

Log out?
I meant redirected to logout page.
>
>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.
There are lots of events which talk via an Ajax library to the server.
>
>Is there any code which can detect javascript events and reset any
timeout timer?

Has this to do with the text above?
>
Aug 30 '06 #3

P: n/a
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!
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"?
>>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.

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?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 30 '06 #4

P: n/a
Evertjan. wrote:
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.
Aug 30 '06 #5

P: n/a
turnitup wrote on 30 aug 2006 in comp.lang.javascript:
Evertjan. wrote:
>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.
"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(...,..)
}

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 30 '06 #6

P: n/a

turnitup wrote:
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?
--
Rob

Aug 30 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.