473,503 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page Session Countdown Timer

MC
I would like to display a timer in the corner of the page that shows the
user how many minutes:seconds till the session times out. Are there any good
examples out there?

Google has again failed me ;)

MC
Mar 22 '08 #1
9 3836
MC wrote on 22 mrt 2008 in comp.lang.javascript:
I would like to display a timer in the corner of the page that shows
the user how many minutes:seconds till the session times out. Are
there any good examples out there?
Session is a serverside concept.
Clientside, thee is not such a thing as a session timeout.
Google has again failed me ;)
Do you want Google to write your programming?
It will cost you!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 22 '08 #2
MC
Evertjan,

I have to say your wrong. A javascript can track every time a page loads,
and knowing the session timeout, calculate an approximate, hopefully +- less
than one second, session timeout.

I would like to, given a timeout such as 30 minutes, have a countdown from
the onload event. It would then be nice to prompt the user to logout or
continue the session by sending a message back to the server to refresh the
session.

I say your wrong, because session timeouts ARE being done currently in many
websites such as banks. ...and I never suggested Google write my code, but
that Google search find an appropriate example.

Please troll someplace else if you have nothing constructive to add.

MC

"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
MC wrote on 22 mrt 2008 in comp.lang.javascript:
>I would like to display a timer in the corner of the page that shows
the user how many minutes:seconds till the session times out. Are
there any good examples out there?

Session is a serverside concept.
Clientside, thee is not such a thing as a session timeout.
>Google has again failed me ;)

Do you want Google to write your programming?
It will cost you!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Mar 22 '08 #3
MC wrote on 22 mrt 2008 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>MC wrote on 22 mrt 2008 in comp.lang.javascript:
>>I would like to display a timer in the corner of the page that shows
the user how many minutes:seconds till the session times out. Are
there any good examples out there?

Session is a serverside concept.
Clientside, thee is not such a thing as a session timeout.
>>Google has again failed me ;)

Do you want Google to write your programming?
It will cost you!
[Please do not toppost on usenet]
I have to say your wrong. A javascript can track every time a page
loads, and knowing the session timeout, calculate an approximate,
hopefully +- less than one second, session timeout.
No it cannot, as there could be another call in that session resetting
the sererside timeout counter.

Clientside cannot know that, unless it pols the server by ajax or alike
to ask the present value of the timeout counter. Under ASP it is not even
available, I suspect the same goes for PHP, but I don't know.
I would like to, given a timeout such as 30 minutes, have a countdown
from the onload event. It would then be nice to prompt the user to
logout or continue the session by sending a message back to the server
to refresh the session.
You cwertainly can do that, but it does not reflect the session state.
I say your wrong, because session timeouts ARE being done currently in
many websites such as banks.
Those sites heavily rely on serverside, I hope.
...and I never suggested Google write my
code, but that Google search find an appropriate example.
You did not suggest anything of the sort, though I might be what was in
your mind. You only said Google had failed you. If that was about
searching and not about the share value, it could also be that your
searching skills were not perfect. How would we know?
Please troll someplace else if you have nothing constructive to add.
So now you become abusive, thinking this NG is your personal helpdesk and
by asking Qs you have a right to dictate the answers?

My aswer was constructive, showing you you asked the wrong Q an prompting
you to a better one.

A countdown timer in Javascript, you simply could have asked for that,
is a simple affair, can be written within 10 minutes. But you did not ask
for that.

If you stay polite, maybe someone will help you.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 22 '08 #4
MC
Sasuke,

Thank you. This should work quite nicely! I will be able to show the user
how much time is left on the page till timeout. I should be able to even
'show' a form saying they are going to time out in soon, and give them the
opportunity to refresh the session with a button there.

Thank you for helping!
MC
Mar 22 '08 #5
In comp.lang.javascript message <Xn********************@194.109.133.242>
, Sat, 22 Mar 2008 16:09:49, Evertjan. <ex**************@interxnl.net>
posted:
>MC wrote on 22 mrt 2008 in comp.lang.javascript:
>I would like to display a timer in the corner of the page that shows
the user how many minutes:seconds till the session times out. Are
there any good examples out there?

Session is a serverside concept.
Clientside, thee is not such a thing as a session timeout.
A client can count down for a length of time indicated by the server;
and can occasionally be synchronised with the server's opinion.
>Google has again failed me ;)
Try "Good countdowns" as your search string.
As a contrast, seek countdowns on .gov sites.

TD09690 : Until 03 September 2081 10:07:31 LCT : 26827d 11h 54m 56s .

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Mar 22 '08 #6
Dr J R Stockton wrote on 22 mrt 2008 in comp.lang.javascript:
>>Session is a serverside concept.
Clientside, thee is not such a thing as a session timeout.

A client can count down for a length of time indicated by the server;
and can occasionally be synchronised with the server's opinion.
However, John, the server, under ASP at least,
does not know at the scripting level,
what the countdown status of the session timer is,
so much for the server's opinion.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 22 '08 #7
On Mar 23, 4:05 am, "MC" <mica[removethis]@aisus.comwrote:
Sasuke,

Thank you. This should work quite nicely! I will be able to show the user
how much time is left on the page till timeout. I should be able to even
'show' a form saying they are going to time out in soon, and give them the
opportunity to refresh the session with a button there.

Thank you for helping!
MC
Glad I was able to help. Hope it all works out well for you. :-)
Mar 23 '08 #8
"Evertjan." <ex**************@interxnl.netwrites:
Not fairly at all.

If the user does alt-N and has two duplicate pages, and clicks to another
site page from the second page 15 minutes later, the first page will show
the session is gone, while the session lives on happily [though not ever
after], and the session can be used from the page with the counter that
tells you it cannot.
Yeah that's true. There are ways of working around this problem, of
course. Provided you've got enough control of the session mechanism at
the server side you could just do a periodic Ajax request to check the
session status.

I still don't know what you mean about the *server* scripts not knowing
what the session timer is. Sounds like a really strange restriction to
me.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Mar 23 '08 #9
Joost Diepenmaat wrote on 23 mrt 2008 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.netwrites:
>Not fairly at all.

If the user does alt-N and has two duplicate pages, and clicks to
another site page from the second page 15 minutes later, the first
page will show the session is gone, while the session lives on
happily [though not ever after], and the session can be used from the
page with the counter that tells you it cannot.

Yeah that's true. There are ways of working around this problem, of
course. Provided you've got enough control of the session mechanism at
the server side you could just do a periodic Ajax request to check the
session status.

I still don't know what you mean about the *server* scripts not
knowing what the session timer is. Sounds like a really strange
restriction to me.
Ours is not to ask the why of the language/platform at implementation
time,
just to implement it.

ASP cannot read the actual state of the session timeout counter.
PSP probably has the same restriction.

The only time that you know it's state is at the reset moment.

You could test by Ajax if the session is still active,
but that would be done "destructively",
as the counter is reset by the test.

Kind of a quantum measurement dilemma, isn't it?
Provided you've got enough control of the session mechanism
You could forego the server internal session mechanism,
[which depends on a session cookie, btw],
and build your own session with a database.
Then you can read the last session reset time from that database.

That probably is the way some banks do their work, having an session-id
in the querystring, and no cookies necessary for that.

The above shows a timeout timer is not even necessary, only a comparison
of 'now' to the last resettime at every new html request [and some sort
of database garbage collection sql execution now and then].
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 23 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2673
by: Bonnett | last post by:
I have been creating a generic countdown timer (source code below), counting the seconds, minutes, hours and days till an event, but I have having trouble with it finding out how many hours are...
8
3734
by: Michael | last post by:
I have this script that works the way I want except for one thing... Once it hits zero it starts to count up and looks like this: -1:0-1:0-1:0-18 with the last number counting up. Can anyone...
1
29524
by: Will | last post by:
I have form showing instructions and logging actions and I would like the form to show a count down timer for a certain period of time. E.g. 30 secs, going down to 0 and then displaying the action....
1
2077
by: jmgro | last post by:
I have spent way too much time trying to solve the following problem: I have a datalist with a timer in the footer template. It works wonderfully except when the user pages back, then forward,...
1
1753
by: Yannick Benoit | last post by:
Hi everyone. I want to create a script which post a form with fields to fill in but with a timer so that if the person fills the form in 10 seconds he gets a specific score but if its in 20 then...
3
4367
by: JimJam | last post by:
Hello Peeps I have created a program in VB.NET 2003 that counts down from 7.5 hours to zero from 08:00. I have a button that starts a new countdown from 1 hour to zero whilst the first one is...
1
2159
by: Dirk Hagemann | last post by:
Hi! I'd like to implement a countdown timer on a webite. It should show the months, days, hours, minutes and seconds until a given date and time. So far it's not really difficult, but this...
9
2314
by: Yet Another One | last post by:
Sorry if this has been answered before, but I simply cannot find the solution on my own. I am looking to do a countdown in my application. Basically, I need to count down from 5:59 (5 minutes,...
3
3685
by: =?Utf-8?B?VG9ueSBTZXI=?= | last post by:
Come across an issue with IIS process HTTP request one by one, not simultaneously. I have a page that takes a long time to process. When the page is accessed by 2 seperate browser, both request...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.