Click here to Skip to main content

TSLin306 asked:

Open original thread
Hi all,
 
Is there a way to use same javascript timer variable from multiple tab pages?
Can I save it to somewhere like cookie?
 
For more details:
I'm developing a ASP.Net web page that shows countdown timer 1 minute before session was expired. I implemented this by adding javascript timer (setinterval method). Timer was reset on every Client (Ajax) or Server postbacks.
In every timer tick, I write TimeOutValue-1 into cookie file. When the value of cookie less than or equal to 60 (1 minute), I show a new form that contains "Extend" or "Logout" buttons.
Problem is if I open two tab pages, both page run with their own timers and reducing value from cookie together.
So, if I have only one page, value will be reduce like 10, 9, 8, 7, 6, etc...
If I have two pages, it have been reducing 10, 8, 6, 4, etc... Frown | :(
 
My approach my be wrong coz I am very new to Javascript.
Please give some solution or guide me to achieve this goal.
 

Thanks in advanced
Tags: Javascript

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid