| Reference | Downloads | Github

Timing in embedded html (iframe) / PsychoJS vs. JS

Dear all,

I’m working on an exp. with embedded html pages using iframe, based on

(much much thx for the two great posts)

The task is to check the html page out and then click a button on the same page (also implemented with html).

One of the dependent var. is the rt (from onload of the html page til the click of the button).

I’ve googled for a while but I did not find any docu. regarding the timing of this iframe embedding method in psychojs.

It would be really nice if someone with more expertise in psychojs timing could tell me,

if the iframe embedding would have any influence on the timing using psychojs functions?

Specifically, using globalClock.getTime() on the html body and alike.

I’d also like to know, is there a difference in the timing between the psychojs functions and JS functions, for example, new Date().getTime() ?

(any other more reliable ways to create timestamps with JS are also willcome!)

Would it be better if I use JS functions in embedded html to measure rt instead of psychojs functions?

Best wishes

I think some experimentation is needed. How about starting a clock and saving the time in Begin Routine and the first and last frame.

I’m not sure of how to get accurate timing within the html page but if you do then you could add that too, and compare the results

Nice question! My paper might help you out in this. It compares a whole bunch of methods for timing stimuli and registering response times, but most interestingly to you could be the included example scripts. One tip: if you use HTML (instead of canvas, like PsychoJS does), first draw your DOM elements with opacity = 0, then a couple of frames later, show them by changing the opacity. The reason is that drawing the page involves all kinds of layout stuff that can take a while, but showing/hiding a DOM element via opacity does not trigger any layout changes, so no delay on the side of stimulus presentation.

1 Like