Adding JavaScript to a theme in /head not working (UserWay)

Hi everyone,

I’m trying to customize a theme to add the UserWay Accessibility widget. I’ve copied and pasted exactly what was provided by UserWay in /head, which is where I’ve actually seen it used on another Discourse account (this one).

Here is the code:

<!-- UserWay accesibility widget -->
<script type="text/javascript">
var _userway_config = {
/* uncomment the following line to override default position*/
/* position: '1', */
/* uncomment the following line to override default size (values: small, large)*/
/* size: 'large', */
/* uncomment the following line to override default language (e.g., fr, de, es, he, nl, etc.)*/
/* language: 'null', */
/* uncomment the following line to override color set via widget (e.g., #053f67)*/
/* color: '#5BC0BE', */
/* uncomment the following line to override type set via widget (1=person, 2=chair, 3=eye, 4=text)*/
/* type: '1', */
/* uncomment the following lines to override the accessibility statement*/
/* statement_text: "Our Accessibility Statement", */
/* statement_url: "community.fatbesties.ca/accessibility-statement", */
/* uncomment the following line to override support on mobile devices*/
/* mobile: true, */
account: 'ACCOUNT_INFORMATION'
};
</script>
<script type="text/javascript" src="https://cdn.userway.org/widget.js"></script>

And a screenshot

Any suggestions?

1 Like

Try adding https://cdn.userway.org to the

content_security_policy_script_src

site setting and see if that resolves your issue.

Like so

6 Likes

A post was split to a new topic: Automatically adding theme scripts to CSP

Thanks, @Johani, that worked! :clap: :clap: :clap: :clap:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.