Making discourseEmbedURL match expected topic requirements

Thanks Vinoth. I’m testing that idea on a public site, but now I’m running into an error loading the embed.js. I may not have mentioned, but we’re also using google oauth2 to control access to this site. I’ve added https://meda.discourse.org/auth/google_oauth2/callback for the login callback but it looks like we may need to host the embed.js locally unless there are other suggestions.
Since I’m testing in Safari, I tried changing the discourseUrl to ‘https://citadel-discussion.lexmachina.com/’ so that both would be in the same https domain, but that resulted in an ERR_CONNECTION_REFUSED response.

  • Jeff

[blocked] The page at https://citadel-gauth.stage.lexmachina.com/cases/88 was not allowed to run insecure content from http://citadel-discussion.lexmachina.com/javascripts/embed.js.

BTW, the update javascript looks like this:

<script type="text/javascript">
    $(function()
    {

        var DiscourseEmbed = { discourseUrl: 'https://citadel-discussion.lexmachina.com/',
                          discourseEmbedUrl: 'https://citadel-gauth.stage.lexmachina.com/cases/88' };
        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>