Permanent VARIABLES and "Smart Countdown" ?

I have created a small program which shows the minutes left to the top of the hour (ie. if it's 9:34pm right now, the count down show: 00:26 mins left).  I used the <IMG> command to call my CGI script which sends back binary data of a GIF picture corresponding to the correct digits of the minutes left.  So it looks like I have a "graphical" countdown of the minutes left.  

I use Javascripting to call a function every 1 minute.  In this function it makes a recall to my CGI script to get the *present* minutes left.  This way the counter is counting down graphically every minute.  

I want the user of my web site to have the ability to refresh the screen, leave my web site and BACK up to it at a later time, and to ALWAYS see my countdown at the EXACT minutes left before the hour.  I achieved this with always calling my CGI script to get the latest minutes left.  Unfortunately, I want ONE more thing.  I want the countdown to countdown to 00:00 and never go past this!  As soon as it hits 00:00 it pops up a new graphic to tell user to RELOAD the web page since it is old.  

Now if the user is allowed to leave my web site and is allowed to back up to see the NEW minutes left before the hour, he could leave my web site for DAYS and then back up to it seeing the new minutes left before the hour, but 00:00 of the hour he really came in had long passed.  The graphic that should pop up would never pop up until 00:00 is reached for this hour.

Is there anyway I can use a PERMANENT VARIABLE in Javascripting (persists even if the user leaves my web site) which can store some useful data to solve this problem?  Or is there another trick I can use to make sure the user gets the graphic: RELOAD THIS WEB PAGE, because the end of the hour when you arrived has lapsed?????



ljaquesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alamoCommented:
The "permanent variable" you refer to exist- cookies. You can read and write cookies from javascript. You can also read and write cookies from a .pl. When your script returns a countdown digit it could set a cookie that gives the time to pop up the "reload" message. Whenever the countdown digits are loaded, if the cookie sees the "reload" message time is past it could send the reload graphic.

Be aware though that a lot of people hate cookies and have them turned off, so this won't always work and will annoy some people. I haven't checked whether the "ask before accepting cookie" flag applies to javascript too, though I would assume so.

If your entire page is produced by a script, you could set the expires time to the top of the hour, which is probably a cleaner way of handling this.

let me know when you get some points :-)
0
malecCommented:
Another option is to use Perl script to save var value to file on a server but you'll need to associate every such file with the user (I would use his IP address for that). Advantage - no need for cookies and, therefore, reliability, because you don't have to depend on users acceptence of the cookie. Disadvantage - number of files can grow indefinitely. The whole thing will take just coule of lines in perl.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ljaquesAuthor Commented:
Adjusted points to 5
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.