Problem embeding a topic in a page on another domain

I signed up for the 14 day trial to see if Discourse can do what we’re trying to achieve. Basically we want to be able to embed topics in to specific pages and have them operate in a similar manner to a comments section.

The problem I am having is when I embed a topic in a page it prompts me to login to the forums. When I click login, I get the following errors in the console:

  • Blocked autofocusing on a element in a cross-origin subframe.

  • DOMException: The ‘publickey-credentials-get’ feature is not enabled in this document. Permissions Policy may be used to delegate Web Authentication capabilities to cross-origin child frames.

I have added the domain to the allowed hosts and the embed code is listed below.

<div id='discourse-comments'></div>

<script type="text/javascript">
  window.DiscourseEmbed = {
    discourseUrl: 'https://forumname.discourse.group/',
    topicId: 5
  };

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

Would somebody be able to kindly point me in the right direction of what I may need to be changing to get this working?

Thanks in advance!

Have a look at Embed Discourse comments on another website via Javascript.

Edit: Oops that’s what you did?

Does your forum require login? Is the page you’re embedding publicly accessible?

It does require a login at the moment. Looking where to switch it off, where is that?

And I’m just trying to embed one of the per-created topics in the general category.

Thanks!

If you’re on the $50/month basic plan then it’s not available and it’s not going to work for your use case.

I’m not sure if you can switch between plans in the free trial.

Weird, I didn’t see that on the plan comparisons. Do you know which plan allows embedding? Thanks!

Plans don’t limit embedding, but embedding doesn’t work if login is required. I believe that you’ll need at least standard hosting, but I might be wrong.

Thanks. It seems to work now with a standard plan.

1 Like

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