# Failed to execute 'postMessage' on 'DOMWindow'

**URL:** <https://meta.discourse.org/t/failed-to-execute-postmessage-on-domwindow/296690>\
**Category:** Support\
**Tags:** embedding\
**Created:** [February 26, 2024, 12:07am UTC](https://meta.discourse.org/t/failed-to-execute-postmessage-on-domwindow/296690 "2024-02-26T00:07:41Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Joseph3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joseph3/32/365522_2.png) [@Joseph3](https://meta.discourse.org/u/Joseph3)\
**Post date:** [February 26, 2024, 12:07am UTC](https://meta.discourse.org/t/failed-to-execute-postmessage-on-domwindow/296690/1 "2024-02-26T00:07:41Z")

</div>

I have searched the forum for an answer to this issue and tried a few of the different posted options.

I am running a Ghost publication on a Digital Ocean Droplet, and a Discourse forum on a separate Digital Ocean Droplet, as the forum consensus seemed to be that you should not install two applications on the same server.

forum.mysite dot com  
mysite dot com

I would like the discourse comments to appear on every post, and I do not have a [mysite.com/blog](http://mysite.com/blog) URL slug. So I followed the documentation to get the current site URL and use that as the embed URL.

Following the documentation here: [Official Integration Documentation](https://ghost.org/integrations/discourse/)

I am able to get the frame to appear on any new posts. However, it does not load and provides the following error:  
`Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>').`

I have confirmed that my HTTPS settings are correct. My embedded URL mimicks the tutorial, but I tried a few different variations of discourseEmbedUrl: in an attempt to troubleshoot. All of the references to the current article URL are causing the same error.

I also tried adding a wait function, thinking perhaps the frame did not load, but the same error persists.

This is my current embedded code:

```plaintext
<div id='discourse-comments'></div>
<meta name='discourse-username' content='JosephPaul'>

<script type="text/javascript">
  DiscourseEmbed = {
    discourseUrl: 'https://forum.mysite.com/',
    discourseEmbedUrl: '{{url absolute="true"}}',
    // 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);
  })();
</script>

```

Any assistance here would be appreciated, as I have exhausted all solutions posted. I believe it may have to do with my forum and articles being on separate machines.

---

_[View the full topic](https://meta.discourse.org/t/failed-to-execute-postmessage-on-domwindow/296690)._
