473,708 Members | 2,344 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 3867
MC wrote on 22 mrt 2008 in comp.lang.javas cript:
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.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
MC wrote on 22 mrt 2008 in comp.lang.javas cript:
>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.javas cript:
"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
>MC wrote on 22 mrt 2008 in comp.lang.javas cript:
>>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.javas cript message <Xn************ ********@194.10 9.133.242>
, Sat, 22 Mar 2008 16:09:49, Evertjan. <ex************ **@interxnl.net >
posted:
>MC wrote on 22 mrt 2008 in comp.lang.javas cript:
>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.demo n.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.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.javas cript:
>>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.net writes:
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.javas cript:
"Evertjan." <ex************ **@interxnl.net writes:
>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
2684
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 left. When i get it to display a complete countdown (days hours mins seconds left) it is one hour short when counting dates that fall in the following time brackets: 2004,2,29 -> 2004,9,31 2005,2,28 -> 2005,9,30 2006,2,27 -> 2006,9,29 etc..
8
3769
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 help me find a way to stop it at zero? Thank you, Mike
1
29572
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. I want the user to be able to see the seconds counting down. Can anyone help me? thanks
1
2090
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, and the counter is reset. I saw in one of Kevin Spencer's comments not to put the timer in javascript on the load function, but I have to get the script to run before the page is rendered, otherwise my timer is not displayed. I have a flag "Hidden...
1
1769
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 the score is lower etc... I can put on a countdown or timer using javascript but i dont know how to grab the time from that timer and post it with the form. Anyway can help ?
3
4382
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 couting down from 7.5 hours. How do I pause that time that is counting down from 1 hour & behind a new button restart it without losing one second? I would also like the time to count down from 37 hours, but will pause after
1
2166
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 website will be used from different time zones, what will make a difference of 10 hours, if I use the time-information from the client. The event will take place at one fixed moment which is worldwide the same. Does anyone know a way to solve this...
9
2324
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, 59 seconds) and then perform a task. Performing the task is easy enough, but the countdown is just slipping past me. Anyone have any idea how I can best achieve this?
3
3709
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 will be processed the same time. But if the 2nd browser is opened by IE->File->New Window, when the 2 browsers try to access the same page, the requests are handle sequentially. Same behaviour with 2 firefox browser.
0
8699
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9293
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9064
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7932
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6617
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2508
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2097
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.