Javascript reference error only in Canvas

Community Explorer

Hello everybody.  My javascript skills are a little rusty so I am hoping someone will take mercy on me and help me dubug this script.  We are trying to use a 3rd party script (see to automatically add source links to textual references within our courses.

The script works beautifully on a simple test page but when I call it within canvas I get the following error "ReferenceError: Can't find variable: atomic" with a reference to line 214.

I am calling the script (which I am hosting on our own server to enable https and avoid mixed content errors) with the following code in our custom JS file:

var SefariaScript = document.createElement('script');

SefariaScript.setAttribute('charset', 'UTF-8');

SefariaScript.setAttribute('src', '');

SefariaScript.onload = function () {;};


My first thought was that it was an issue of scope, but the same script (called the same way) works perfectly on non canvas sites. What am I missing??? Please help!

Thanks in advance,