Reading json files error

Hello everyone. I’m using jsPsych version 6.3.1. I’m receiving an error when reading JSON files, which says, “Refused to execute script from ‘’ because its MIME type (‘application/json’) is not executable, and strict MIME type checking is enabled.” I’ve attached a screenshot of my error. Has anyone found a proper solution for why this is happening? I’m not running my experiment from PsychoPy; I’m using jsPsych in JavaScript.

Dear @aysegul92 ,

The issue has to do with your having Javascript code in .json files (those located in the “json” sub-directory of your experiment).
Not only does this make your json files invalid (i.e. they are not valid JSON code) but it is also a security risk (i.e. people do not expect executable Javascript code in what is normally used to contain only data). As a consequence those files are blocked by the browser.

A solution would be to give them a proper .js extension, rather than .json.
Best wishes,

Alain

1 Like