Streaming live at 10am (PST)

Access to script at [...] has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

#1

Goal:

Load Postscribe, which will enable me to embed github gists into CMS collections per this blog post.

Steps to Recreate issue:

  1. Open up one Article (gists typically appear the first time, for some reason). ex: like this
    0
  2. At the bottom in the “Recent Blog Posts” section, click on another Article, such as this one
  3. On this page, the gists don’t load:

Here’s the browser error:

READ ONLY LINK

live site: www.gregcondit.com

Here’s the relevant custom code which is copied into the footer code:

<!--Add Postscribe for displaying gists--> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.8/postscribe.min.js"></script>

<script>
// define the load gist function
var loadGist = function(elem) {
    var gistUrl = $(elem).text().match(/\bhttps?:\/\/\S+(.js)/gi);
    if (typeof gistUrl === 'undefined' || gistUrl === null || gistUrl.length == 0) 
        return;
    //load gist
    $(elem).show();
    $(elem).empty();
    postscribe(elem, '<script src=' + gistUrl+ '><\/script>');
    };

var gists = $('p:contains("CODE:")');
gists.hide();
gists.toArray().forEach(loadGist);
</script>

How can I get this to load consistently?

#2

Looks to be working for me. Did you resolve it?

#3

Thanks for your note. No, CORS policy was still blocking postscribe at somewhat irregular intervals. I ultimately had to copy the whole library into my custom code section, and it works now.