Adding an embed to an Wix website for commenting

I have looked up most of the topics and videos regarding embedding discourse topics on a separate website and have been running into issues with this on a Wix website. All I get is an error saying : Refusal to connect

On the embedding page I have gone through and added the allowed Hosts for the website. I have the category selected and everything appears to be good.

I replaced the EMBED_URL with the URL of the page to embedding on.

I replaced the DISCOURSE_USERNAME with my Discourse username for creating the topic.

I pasted the entire HTML code into the HTML iFrame on my website. Yet it just doesn’t seem to work for some reason. No sure where I am going wrong.

Any idea on what I can do to fix this?

I saw one person mention JSON or RSS in a different topic but I have no clue how to go about the process. Has anyone successfully added a Discourse embed onto a separate website?

hi @ethanjs welcome to meta :wave:

i’m not certain, but i don’t think you can embed Discourse content into an iframe.

my site uses the embed on our Discourse forum as the engine for the comments section of our parent site at the bottom of articles and it works quite well for us that way.

this discussion may help:

1 Like

@Lillinator Thank you for the quick response back!

I see. I think I saw someone mention that in one of the topics too where you can’t paste directly into a iFrame.

When I paste the code directly into the site Velo by Wix is gives me an error saying “JSX expressions must have one parent element”.

that’s because you have a code error and you are trying to return two expressions when only one is allowed somewhere. post your code and let us have a look.

1 Like

code should look like this i but with your posting username and the EMBED_URL as the url of the site you are embedding to:

<div id='discourse-comments'></div>
<meta name='discourse-username' content='DISCOURSE_USERNAME'>

<script type="text/javascript">
  DiscourseEmbed = {
    discourseUrl: '',
    discourseEmbedUrl: 'EMBED_URL',
    // className: 'CLASS_NAME',

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
1 Like

Is it possible to do a fragment? I tested this and it seemed to show different errors. But now it’s for ‘react’

you shouldn’t have to fragment it and that code should work as long as you have the EMBED_URL and DISCOURSE_USERNAME correct. maybe check over your allowed host paths and categories configuration again. :thinking: i don’t know anything about Velo by Wix.

1 Like

Updated the following : EMBED_URL & DISCOURSE_USERNAME

For some reason without the fragment the whole coding gives an error. Like in the image at the first picture but now with the Updated info.

I went ahead and created a post over in the Velo forum to see if they might know where I’m going wrong

I would absolutely love to know how to get this to work. I mean, even without the commenting ability but to just connect each page to the forum would be awesome!

1 Like

i take it you have read this: Wix Editor: Embedding a Site or a Widget | Help Center |

it seems they load into iframes there.

1 Like

:smiling_face_with_three_hearts: Love this^^^^ :smiling_face_with_three_hearts:

1 Like

yep that’s our site :slight_smile: thanks. i’m the admin of the Discourse forum, but not the site it’s embedding to.

yea i don’t see any error in your code so i wonder if it’s the wix site. it may be the other settings like allowed hosts and paths with wix. hopefully they can give you some assitance from their end or someone here may recognize your issue and be able to help. at the moment, i am not seeing why it isn’t working for you.

1 Like

Yeah, I read through the Embed instruction. I also called the Wix support like 4 times. They directed me to their expert team but was sent to voicemail b/c they were too busy. Then, I got an email a few days ago.

I’ll likely respond to that email with additional details about the request.

Sent them a message just now

yea i suspect it’s because Discourse won’t load embeds into iframes.

1 Like

I think you’re right on that w/ the iFrame. I followed the instructions from the Admin>Custom>Embedding page. Attempted to alter & update it in every possible way I could think of.

iFrame is likely the root of the problem since it’s a javascript. I did notice that link you last sent has a section called “Custom Element” below the HTML & Embed a Site. Which I believe that’s probably what’s holding it up.


Thank you so much for all your help Lilly!

1 Like

you’re welcome @ethanjs but i’m sorry i wasn’t able to help you more. :face_with_diagonal_mouth:


All good, I’ll post back on here what I hear from the Wix support.

I’m guessing this is mainly just an issue among their website compared to something like Word Press. Seems like a common issue other Wix users have run into over the years without a clear solution.