External javascript not working in LMS
March 8, 2017 12:00 AM
I have a test course containing an HTML extension of type "Meta tags" that references an external .js file. The file contains an array, which populates a drop-down list (thanks again, Maths!). The idea here is that we want to be able to update the options that learners can pick from without having to edit and republish the course every time the list changes.
In every mode of Lectora, including previewing in the browser, this works beautifully. However, when I upload the course to our LMS (Cornerstone) or to SCORM Cloud, it doesn't work at all. As far as I can tell the script never fires.
Any theories, suggestions, wild guesses?
undefined
Discussion (7)
Sergey, unless I'm seriously misunderstanding you, adding the script as an attachment in Lectora would defeat the purpose; the whole idea is to not have to republish the course every time the list changes.
But thanks for the reminder to check the console! Turns out the script is being blocked because it's in an unencrypted location, while our LMS (and SCORM Cloud) run over HTTPS. I'm actually highly confident that once I find an encrypted location for the script, everything will work swimmingly -- and that's a big change from my "are you $@# kidding me???" attitude from yesterday. :-)
Check the console. Did the file even load? Is the file mentioned in the SCORM manifest? Some LMS won't load a file unless it is mentioned in the manifest (which means it must be added to the Lectora title as an attachment).
I thought your script was local to Lectora and it just pulls the data (the list of stores) from somewhere. Anyhow, glad to know I gave you an idea that helped. And today everything must run over https. You can use GitHub + RawGit for this.
I think page provides helpful info:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
Hey there!
We're experiencing the exact same issue. We uploaded header scripting in our courses to include Greensock, (tweenmax) and it works great in preview mode but once in ReviewLink and in our LMS (Cornerstone) Nothing.
Any advice on how to get simple "pulse" animations on objects (buttons) to work?
Thanks,
Kelsey
It may be "Seamless play" that makes the difference. You could try whether it works without it, or check the sample that should work both ways. I tested it locally, in ReviewLink and moodle.
undefined
Hey Nick!
Seamless play was the issue! Thanks for sharing that tip. The Javascript is working fine in Cornerstone now.
Kelsey
Discussions have been disabled for this post