Online: win is undefined

Hi everyone,

I am piloting my experiment online and I keep getting the error message win is undefined.

In my begin experiment tab I have the following code:

window.thisExp = psychoJS.experiment;
window.win = psychoJS.window;
window.event = psychoJS.eventManager;
window.shuffle = util.shuffle;
win = psychoJS.window;
thisExp = psychoJS.experiment;

I have tried running the experiment in both Firefox and Chrome, in Chrome I get the error message TypeError: Cannot read property ‘_psychoJS’ of undefined.

Any advice on what I should try?

Cheers!

That code isn’t the same as suggested on my 2020 crib sheet, which is

thisExp=psychoJS.experiment;
win=psychoJS.window;
event=psychoJS.eventManager;
shuffle = util.shuffle;

Thanks Wake.

I have updated the begin experiment tab with your code and I still get the win is not defined error message. Any ideas what else I could try?

Ctl-Shift-R to flush the cache and run the latest version of your experiment

Tried refreshing the page and I have manually cleared all my cookies and caches, but still the same error message in Firefox. Also tried it in Chrome but I still get the error message: TypeError: Cannot read property ‘_psychoJS’ of undefined