Hello! We are getting an Error Embedding, the iframe says
Error Embedding
Referer:
The referer was either not sent, or did not match any of the following hosts:
even though the domains are identical, and the console says:
Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.
_embed-application-3723be59920e64ecda9d66b1e7c4c55378fb9dadfa7f422febd4f1b346c1aa05.js:6 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.
at e (https://sjc1.discourse-cdn.com/business5/brotli_asset/embed-application-3723be59920e64ecda9d66b1e7c4c55378fb9dadfa7f422febd4f1b346c1aa05.js:1:42)
at window.onload (https://sjc1.discourse-cdn.com/business5/brotli_asset/embed-application-3723be59920e64ecda9d66b1e7c4c55378fb9dadfa7f422febd4f1b346c1aa05.js:1:470)
We are using the ‘Alternate configuration’ so the solved topic doesn’t really help us.
(Alternate Configuration) Linking to existing topics
Some people prefer to not have Discourse create topics for them automatically on their forums. They’d like to create the topics themselves, then simply tell their embedding code what topic they want to associate with. You can do this by slightly changing your embedding code:
<div id='discourse-comments'></div> <script type="text/javascript"> DiscourseEmbed = { discourseUrl: 'http://discourse.example.com/', topicId: 12345 }; (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); })(); </script>
The only difference here is we’ve replaced
discourseEmbedUrl
with the id of a topic from Discourse. If you do this, no topic will be created and the comments from that topic will automatically be displayed.
from Embed Discourse comments on another website via Javascript
Any way we can debug this easily, where does it get the referrer and why could it be empty?
Is it a known/common issue and is there a way to hide the iframe or its contents when it errors?
Clicking through to the script where it errors it seems to not be able to find a referrer for a postMessage
in the #data-embedded
element.