Javascript prez.time not work in scorm resume session

Versione 9.1.2

as long as the scroll window remains open, prez.time returns the correct value. but if you close the “scorm” window and then reopen it prez.time always returns the value of 0.

but it work in html preview in activepresenter

How are you triggering this and displaying the value?


	if (questionTimeRange[1]>=prez.time())

There should be some sort of an event that triggers the script.
Is the learner clicking a button which executes the JavaScript or is there an onLoad action to the slide…etc?

I notice you are making use of both time() and slideTime()

time() will provide the milliseconds based on where you are in the entire presentation whereas slideTime() will provide the milliseconds based on where you are in a given slide. That means the values may not match up.

Is there more to the code above? it seems incomplete.

Is the alert supposed to be the action that takes place when the if statement returns true?

its run in this function:
prez.myShowSection = function(atSectionStart) {
var sectionData = this.mySections[this.mySectionIndex];
if (!sectionData)
if (atSectionStart)
var questionTimeRange = sectionData.questionTime;
this.myRandomQuestionTime = randomNumber(questionTimeRange[0], questionTimeRange[1]);


	if (questionTimeRange[1]>=prez.time()) 
		alert('entra nella if');
			alert('salta sezione');
			alert('salta sezione prez.time:'+prez.time());


is this a couse with random silde in random range

note timeelapsed work in scorm
and prez.time work too until user close the window course (moodle paltform)
but if reopeon restart course windows the bar for example say 2 minutes but prez.tim is 0

I was working on trying to connect all the dots.

At the moment I see your function called myShowSection() but I do not see where that function is called.

My concern at this point is that in an LMS environment where the course is being resumed at a point somewhere in the middle - are we at a point beyond where something that needs to be called is being missed?

In other words - perhaps this works fine when starting from the beginning because all the dots are in place but does not work correctly when starting in the middle because critical functions are getting bypassed?

Could this be the issue…?

Unfortunately - I will be away from my computer now for a while and will not be available to help brainstorm this again until tomorrow.

1 Like


The prez.time script is functioning correctly in our test, as demonstrated here:
If you suspect that your script may have an issue, please feel free to share your project with us. You can either attach it publicly here or send it privately to for evaluation.