psychopy.org | Reference | Downloads | Github

Stroop Demo JS version stuck at "initializing the experiment"

Hello experts,

I followed the basic tutorial for creating experiments with PsychoPy and then tried to convert the python code to a HTML + JS online experiment, following the instructions on the psychopy webpage. When I open the ‘index.html’ file, my Chrome browser gets stuck on “initializing the experiment”. Inspecting the console, I see the following messages:

“index.html:1 Access to script at ‘file:///C:/Users/path/to/psychopy/Stroop/html/stroopExperiment.js’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
stroopExperiment.js:1 Failed to load resource: net::ERR_FAILED
Tone.min.js:1 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
s.default.Context @ Tone.min.js:1
Tone.min.js:1 * Tone.js v13.8.6 *
Tone.min.js:1 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

(I’m running psychopy 3.2.4 on a machine running Windows 10, with a Chrome browser).

Thanks!
-Matan

Hi @TanZor, you will not be able to run the experiment by opening the index.html file in your browser. If all has gone well with your code conversion, you should be able to sync your project with Pavlovia, and run it from there. There are some steps to get your study activated. You must first set the status of your study to either PILOTTING or RUNNING. If you set to PILOT, you will have to run your task from Pavlovia, because a unique code is attached to the URL which has a valid lifetime of 1 hour. After this, you will have to regenerate the URL from Pavlovia. If you set the status to “RUNNING”, you will have to use credits to run your study, or your institutions site licence, but you can run your study from Builder this way - but note the cost in credits.

Thanks @dvbridges! So is there no way to output a standalone JS script of the experiment?

There is a feature in development where users can run their psychoJS studies from their browser locally, but for now you have to sync your study with Pavlovia for both piloting, and running for data collection.

Okay, thanks!