Javascript timer for absolute time since course first opened

Feb 26, 2021

Hi

I'm hoping that someone has done this before, so I dont need to reinvent the wheel. I know there are some experts here on JS. I had a look on previous threads about JS timers, and dont see this case coming up before.

What I want is a timer on the screen that counts up in minutes from the moment the user first opens the course and clicks start button. Then, even if the window / browser is closed, the time will still be counting. So next time they open the storyline, the counter will show total time since clicking the button.

So I can imagine this in JS. Get the absolute time, store a variable, and continually work the difference between start time and current time based on 1 second repeating trigger.

But my JS skills are not enough to do this from scratch. Any help here is appreciated.

1 Reply
Sam G

Hi Matthew

Thanks for that. Yes I think that's exactly what I was looking for. I will have a play.

Since I have you here - I made a course using your opening slides with URL query string to point to specific slides, which works well. The only issue I have is that there is about a 3 second delay between the slide opening and the trigger firing or the new slide loading which means you always see the last slide viewed when opening the link. I got round this by having a black background for 3 seconds in every timeline. But I was wondering if there is any other workaround or a trigger that fires before the one I'm using now, which is in the master template slide, when timeline starts (to trigger the js)

I suppose this is the first trigger that fires when the course opens and there's no way to avoid that issue with the last slide viewed opening first?