-
Hi, Has anyone ever encountered this error message: Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-B9TadMAYysdBFYdO6iojnXCqT87DVPa1r+Hmhp2bZf0='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback. Refused to load the font '' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback. I'm trying to host an experiment coded using JsPsych on Cpanel. Many thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @NicoBiagi, It sounds like the hosting is configured to not allow <html>
<head>
<script src="jspsych.js"></script>
</head>
<body></body>
<script>
const jsPsych = initJsPsych();
</script>
</html> ... you may need to move the script into its own file and load it: const jsPsych = initJsPsych(); <html>
<head>
<script src="jspsych.js"></script>
</head>
<body></body>
<script src="my-experiment.js"></script>
</html> This isn't a jsPsych-specific problem, so you can probably find helpful info in places like StackOverflow too. Here's a relevant Q&A. |
Beta Was this translation helpful? Give feedback.
Hi @NicoBiagi,
It sounds like the hosting is configured to not allow
<script>
tags that are inline. So instead of something like...... you may need to move the script into its own file and load it:
This isn't a jsPsych-specific problem, so you can probably find helpful info in places like StackOverflow too. Here's a relevant Q&A.