The discussion revolves around an issue with embedding comments on a site using Discourse. benscheirman reports encountering an error in Safari when trying to post a message to the embedded Discourse page, with the console showing “Unable to post message to https://forum.nsscreencast.com. Recipient has origin https://nsscreencast.com.”
Falco acknowledges the issue, stating it’s due to recent browser changes and that a fix is forthcoming. In the meantime, Falco asks benscheirman to share the embedding settings. After benscheirman shares the settings, Falco explains that the long load time for the first post and occasional failure to refresh is a known bug, caused by how browsers handle an iframe refresh using a <meta> tag. A proposed fix is available, and Falco shares the PR link (https://github.com/discourse/discourse/pull/13756) for benscheirman to track.
The embed page shows “Loading discussion…” for about 30 seconds.
Then I see this in the console:
Unrecognized Content-Security-Policy directive 'worker-src'.
Unrecognized Content-Security-Policy directive 'worker-src'.
Unable to post message to https://forum.nsscreencast.com. Recipient has origin https://nsscreencast.com.
I presume this is to have the iframe self-size after content is loaded. When I run this in a Chromium-based browser I don’t get this error.
Is there something I need to configure to get this postMessage flow working in Safari?
This is something we are going to fix soon. We rely on the referer for embed requests to check if they are allowed, but recent changes to browsers broke a lot of our assumptions in this area.
It is working, however the first post seems to load a long time and often doesn’t refresh on its own. After that I can see “Start Discussion” or the actual replies.
So the first person to visit a blog post with comments will have to refresh it to see the embed, all subsequent visits will work. We have a proposed fix already and will merge it in a few weeks.