Picture of Jason Chui
Checking if course is served in an LMS
by Jason Chui - Saturday, 12 October 2019, 10:19 AM
 

I need to be able to tell whether a course created using the Authoring Tool is served from an actual LMS or simply hosted on a server.

Reason is when the course is in an LMS, I will retrieve the user name from the LMS as suggested in this post. If, however, the course is hosted on a server, then there is no user name to retrieve and I want to use an alert box to get users to enter their names instead.

I'm using the SPOOR extension and even if the course is in a non-LMS server, the extension gives a fake name, "Sam", as the user.

Any suggestions as to how to detect whether the course is in an LMS or not?

Thanks in advance.

Picture of Matt Leathes
Re: Checking if course is served in an LMS
by Matt Leathes - Monday, 14 October 2019, 9:10 AM
 

Yes, if the spoor extension is always going to be installed then you can check for the existence of the variable window.ISCOOKIELMS - if it's set to false, the course is being run from index.html; if set to true it's being run from scorm_test_harness.html; if it's undefined the course is being launched from an LMS.