Is it possible to have setTimeout not restart when going to different pages on the site?

If I have setTimeout in a script in the header of my site is it possible to have it continue to run as a user goes from page to page without restarting. Is this something I could use cookies to do? Are there any examples I could look at?
crm624Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Sar1973Connect With a Mentor Commented:
Even if you name a setTimeout variable or not, it is supposed to reset on page exit even if you do not use the clearInterval method.
What you ask is to pass the variable value to a page from another and use it as the initial value instead of 0 in order to have a cumulative value instead; you could use the addEventListener and postMessage methods (see http://robertnyman.com/2010/03/18/postmessage-in-html5-to-send-messages-between-windows-and-iframes/, http://msdn.microsoft.com/en-us/library/bb979674(v=VS.95).aspx and http://stackoverflow.com/questions/256754/how-to-pass-arguments-to-addeventlistener-listener-function).
0
 
leakim971PluritechnicianCommented:
0
 
leakim971PluritechnicianCommented:
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
crm624Author Commented:
I'm talking about the setTimeout() Timing event to execute a function after so much time has gone by.
0
 
leakim971PluritechnicianCommented:
yes, the answer to your question is no, you can't
0
 
crm624Author Commented:
Wouldn't it be possible to time the user and store it in a cookie and then add to the cookie when they go to a different page? Then have the function execute when it gets to a certain time.
0
 
crm624Author Commented:
I was able to pass the value of a timer I made and use cookies to start from where it left off.
0
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.

All Courses

From novice to tech pro — start learning today.