| Reference | Downloads | Github

PsychoJS experiment encounters displaying errors depending on the browser used

I am testing my masked priming experiment and encountering different issues that depend on the browser used.

  1. Firefox 67.0.4; Chrome 75.0.3770.100: at some point in the middle of the experiment, I get the white page saying “Something went wrong.” This consistently happens with both browsers.

  1. Safari 12.1.1: at some point in the middle of the experiment, the center of the screen (i.e, where the word should be printed) gets black and there is no way to get the word back. No keyboard response seem to work. If I try to minimize/adjust the browser window, the whole window gets black.

Does anyone know what is happening and how to fix it? I am running the experiment on macOS Sierra 12.12.6. I have created the experiment on PsychoPy 3.1.2.


The experiment now seems to work fine in Firefox and Safari (updated to the latest version and in both Mac and Windows OS’s). The something-went-wrong page still pops up right in the middle of the experiment if using Chrome (updated to the latest version, regardless of the OS used).

The experiment consists of 320 prime-target trials, interspersed with a number of breaks in between. I have also tested a similar, but smaller experiment (216 trials in total, so with 104 less items) and the result is the same: when using Chrome, the experiment crashes without giving anything but a general “Something went wrong” message.

Have anybody ever had similar problems with Chrome? Does any of the developers/administrators @jon, @apitiot, @dvbridges have any idea of what is happening and why? Given that Chrome is one of the most used browsers as of now, this issue seems quite problematic.

Many thanks in advance!!


Hi Rob,

I built an experiment for a fellow M.A. student and they reported similar issues with Chrome. The problem seemed to come primarily from non-Mac users. Unfortunately, I was never able to talk directly with the participants who experienced technical issues, so I can’t be sure exactly what was going wrong.

I thought it might have been related to the amount of data stored in the cache. Participants who cleared the cache on their browser prior to starting the experiment didn’t seem to have these issues any more.


Hi @unagi_pie,

thanks for your reply. I tried to clear the cache, the result did not change.

I did some debugging and it turns out that the crashes seems to be linked to a specific feature of the code of the experiment. The experiment consists of a number of breaks and I needed to make sure that after every break 5 filler trials (as opposed to experimental trials) were inserted. Since PsychoJS is still under development, the only solution that seemed feasible was to hard-code the filler trials as fixed routines to be presented after each break. To avoid useless clutter, each filler routine had three text components (one for the forward mask, one for the prime filler word and one for the target filler word, that were coded to be presented one after the other) and a key component. Each filler routine was coded so that it was presented only after the preceding break (i.e., by using the usual trialHandler attributes). It seems that this hard-coding procedure makes the experiment crash at some point in the middle of the experiment, regardless of the number of total trials (fillers and experimental trials) and regardless of the number of post-break filler trials (since reducing it to 3 and 2 fillers did not change the result).

I would appreciate any kind of help to fix this!

This is definitely beyond my skills in JS to fix. I think we’ll need @apitiot involved. It turns out to be hard finding the glitches in each different browser, but this one seems particularly bizarre and certainly important to fix, obviously

1 Like

Thanks for reaching out. After more debugging, I confirm that the problem was caused by the multiple filler routines. After deleting those, the experiment works smoothly regardless of the number of trials in it.

The buggy code is available upon request (I can’t seem to be able to upload js files here). I just want to explain the experimental design once again, just to be 100% clear. The experiment consisted of a standard masked priming experiment, in which after a practice session, the experiment starts with a loop called loopTrial, in which three main routines are presented: fmaskTrial (forward mask, lasting 500 ms), primeTrial (prime word, lasting 33 ms) and targetTrial (target word, lasting until response); prime and target are linked to a csv file. I additionally wanted to make sure that after each break subjects were presented with 5 filler non-words. @dvbridges and I found a non hard-coded solution for this, but it turned out not to be possible in the current version of PsychoJS, so I went for a hard-coded solution. Basically, I created multiple breakTrial routines, each followed by a series of 5 filler routines. Each filler routine contained 3 text components (fmask_filler, prime_filler, target_filler) and a key component key_filler); the four components were synchronized so that they were presented in the usual order: the mask for 500 ms, the prime for 33 ms and the target (together with the key component) until response. Merging the three parts of a typical priming trial (mask, prime and target) was necessary to have a not too long code (which could have created more issues than not). Finally, the 3rd and 5th breakTrial routines were also preceded by one additional routine each, question_1 and question_2, in which subjects were asked to answer a general question by using a text input field.
The three main routines (fmaskTrial, primeTrial and targetTrial), the 2 question routines, 7 breakTrial routines and the 35 filler routines ( = 5 routines * 7 breaks) were all part of the loopTrial loop. Text components of the question, the break and the filler routines were pre-determined (i.e., they were not linked to any external csv condition file) and were coded so that they were shown after a given number of trials in the csv file were presented (i.e., by using trialHandler attributes and the getSnapshot method).

I know the whole architecture seems very inelegant and quite complicated but it seemed the only way to get what I needed. Hopefully you’ll figure out what in the filler routines (3+ components in one routine? multiple text components to be presented at specific times?) specifically caused the issue with Chrome. I guess this was an unusually complicated design, which hopefully may be implemented more elegantly in future when the relevant methods become available; but still I figured developers might want to know what actually is going wrong.