pipwerks / scorm-api-wrapper

The pipwerks SCORM API Wrapper
http://pipwerks.com
362 stars 125 forks source link

When not using SCORM, JS bug if window.opener is set #39

Closed james-siteclick closed 6 years ago

james-siteclick commented 7 years ago

It seems the wrapper assumes that if window.opener is set, then SCORM is being used.

However if a course is not being used with SCORM, and is opened either via an anchor with target attribute set, or window.open, then window.opener is set in the course and SCORM wrapper throws a JS error.

moloko commented 7 years ago

When used, the wrapper always assumes it should be trying to connect to a SCORM LMS. Typically as a course developer you would provide some other method for launching your content outside of an LMS. For example in the Adapt Learning OS project (which i’m involved with and which uses this wrapper) we have index.html for launching from a regular webserver and index_lms.html for when launching from an LMS. Articulate/Storyline does something very similar.

james-siteclick commented 7 years ago

Thanks very much for your reply, that makes sense. We make modules with a single index.html that are designed to run on web or SCORM, so I guess this is a feature request rather than a bug.

pipwerks commented 6 years ago

I usually design my courses to be functional without SCORM, then add the SCORM tracking after the fact. There's no need for code modification or a separate HTML file, the SCORM wrapper won't do anything until you invoke scorm.init. You can add some conditional code to your HTML file that says if this is being launched in a SCORM-based LMS, invoke the wrapper, otherwise don't touch.

You could also use a JS loading script such as requireJS to only load the wrapper file when certain conditions are met (e.g. if the course is launched in a SCORM environment).