| Reference | Downloads | Github

Problem running an online study

Hi Everyone,

I’m trying to get to grips with the online use of psychoPy, I’ve started small with a very simple stroop task just to see if everything is in place. Currently I can get as far as the box for entering the participant ID and then instruction screen, but pressing ‘space’ doesn’t result in the experiment starting, it just hangs. The FPS counter is running, but I can’t proceed to the actual experiment.

Interestingly pressing escape will quit the experiment and takes us to the final screen. So the keyboard read is working.

I’m using psychopy 1.85.1
The website is hosted by virtualmin, so I’m assuming the required backroom stuff (php etc is available).

Any suggestions for what I might look at next?

Here is the demo experiment:

Here is the output of psychoPy saved upon dropbox:

It runs OK in psychopy itself and narrows key presses to ‘space’ to begin the study.


Best wishes,


Hi Jon,
I am having similar issues. I created a basic program consisting of just text and keyboard.
Following the export into HTML and uploading onto a server, it just hangs after entering participant data.
I then uploaded the sample Stroop program but it also locked up on the instructions screen.
See here -
Do you have a working ‘basic’ online test program that we can use?
Anthony McGuffie

Hi Jon,
I am not sure if this is an error but for every project i create and convert into HTML code, the main.js file inside the vendors folder is exactly the same as the stroop demo - html\js\vendors\main.js
Anthony McGuffie

Hi Jon,

I finally got a simple test to work. It seems that psychoJS keyboard events at present only support the left,right,up,down and escape keys. I was using my normal spacebar to respond. I also needed to change the screen units to normal and not pixel size. See here - for my development tests.

Anthony McGuffie

Ah, well done for tracking that down Anthony (sorry I’ve been running workshops the last 2 weeks and that totally absorbs my brain).
In answer to is there a simple working demo? Yes, it’s here:

@jroberts has committed a fix that looks related to what you’re saying:

so hopefully this part is fixed. Note the other known issues on the list too though (especially with not correctly using randomisation and nReps yet):

1 Like

Hi Anthony,

I believe that you can use a capitalized ‘Space’ in your keylist for a web experiment. In fact, you should be able to use any keys by using this javascript keyboard event viewer:

For the key codes to use, look in the “code” column under UI Events.

To make the experiment work both locally in psychoPy and on the web, include both the original psychoPy name and the javascript name. For example, use both ‘space’ and ‘Space’, or both ‘left’ and ‘ArrowLeft’.

Jon Roberts

Hi Everyone,

Thanks for your input, I’m still not getting any response in the online experiment to letter key presses.

I’ve tried a number of things:

I’ve added the JAVA key codes to the responses, suggested by Jon Roberts (thanks), so in addition to ‘space’,‘r’,‘g’,‘b’ I also have ‘Space’, ‘KeyR’,‘KeyG’,‘KeyB’ in the builder response dialogue box. Yet I don’t get any movement from the initial screen - unless I press the cursor keys.

I’ve also looked at the code for the stroop experiment that Jon posted

This WORKS for me, I can even save the demo-stroop version from within psychopy and upload the html to my website and this runs (with left, right, down) as responses. If I append keys: “r”,“KeyR” to the response dialogue I can’t use these keys when running, I can still use left, right, down.

So as Anthony McGuffie says, cursor keys work. But I can’t get other keys yet, I am able to work around this.

Thanks everyone.


p.s. By changing the answers in the .csv file to “KeyX” and adding “KeyX” to the index.html file I can get letter keys to work.

It’s a clear bug that we’ll need to get sorted (looks like Ilixa made it work for our normal examples, which typically use the cursor keys, but omitted to extend it to the full keyboard).