Click here to Skip to main content
15,879,326 members

How to use same javascript timer from multiple tab pages?

Revision 2
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... :(

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
Posted 14-Jan-13 22:37pm by tslin89.
Tags: