Hi Everyone,
We had a requirement to store the time taken by the respondent in milliseconds to answer a question which was in loop. For this we have used setInterval function with a delay of 10 milliseconds (since this function will be called only after 10 milliseconds even if we are calling it for 1 millisecond) in footer.
But the time stored is different w.r.t different browsers, for e.g. if respondent takes 15 seconds to answer the question, then if the link was taken in any browser except Mozilla the time is getting stored as 15000 approximately which is correct, but in Mozilla the data is getting stored in between 11000-12500 which is not correct.
Below is the piece of code used by us in footer.
[js]
var x=0;
setInterval(function() {
x=x+1;
}, 10);
});
[/js]
and in custom JavaScript verification tab (placed to execute as after system validation)
[js]
var cal=x*10;
$("#[% QuestionName() %]PageTime_hidden").val(cal);
[/js]
Can anyone faced this issue, if yes, can you let us know what might be possible cause in the above code.
setInterval function not working as expected in Mozilla
Resolved
2 replies