[solved] Error Embedding

(Michael) #1

Hi, similar to this post, I’m getting errors embedding comments in a static site: https://bigsmall.io/articles/action-brands-are-important-urgent-credible/

In the browser console, I it says “Loading Discussion”, then “Error Embedding” with this in the JavaScript console:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://community.bigsmall.io') does not match the recipient window's origin ('https://bigsmall.io').

The topics are created in Discourse - I see them in the “Let’s get this discussion started” page listing topics. From the dates, the topics may have been made from the RSS feed integration.

Any suggestions?

discourseEmbed, does not match recipient window origin
(Michael) #2

Bam! Fixed it. Make sure the discourseEmbedUrl is a full URL, not a relative path. E.g.:

              var url="https://dev.bigsmall.io/articles/action-brands-are-important-urgent-credible/"
              DiscourseEmbed = { discourseUrl: 'https://community.bigsmall.io/',
                                 discourseEmbedUrl: url };
              (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);

(Jeff Atwood) #3

@eviltrout can we check for this somehow and warn if it is a partial URL?

(Robin Ward) #4

Sure. It can only show in the Javascript console but it would have helped this person diagnose their issue:

(Michael) #5

Yes! That would have saved us some time. This is a really cool feature BTW, it turns drive-by comments into a community which is cool.

I made a quick comment on the PR about protocol independent URLs. Cheers and thanks for an awesome project!


(Jeff Atwood) #6